Closed ghost closed 3 years ago
Reverted the commit. Fix will have to come from someone with this toolchain already setup (or you can wait a few days for me to do so).
Somewhat related: http://lists.busybox.net/pipermail/buildroot/2019-September/258788.html
@trbednarzyk Try my original commit alongside this patch: http://lists.busybox.net/pipermail/busybox/2019-June/087337.html
Unfortunately, I can't try anything with kiss
segfaulting.
Is there an easy way I could tell where kiss
is segfaulting? I've been running a bunch of commands provided by busybox
and I've yet to find the source of the problem.
Unfortunately, I can't reproduce your segfault issue (and didn't prior to pushing the initial commit). I can upload a static busybox which you'd then temporarily drop into /usr/bin (to be used to build a fixed busybox). Otherwise, you can grab the latest kiss-chroot tarball and do the same.
This runtime breakage is something the C rewrite of the package manager will solve (ie, fully static and fully self contained).
I'm guessing it's /bin/sh
that's the cause of the segfault.
Alongside going full-LLVM, I was trying to make my new KISS install LUKS encrypted, which I hadn't fully figured out yet due to there not being much documentation. I was still doing everything in a chroot on a live Arch Linux installer, but it seems like I can't even chroot /mnt /bin/sh
anymore.
This is the error I get from the above command:
[1] 914 segmentation fault (core dumped) chroot /mnt /bin/sh
I am certainly looking forward to the C rewrite (even though in my specific case I'd still be borked).
In this case, I'd grab a live-USB, boot into it, mount the drives and replace /usr/bin/busybox
with the same file from the kiss-chroot
tarball. There are many ways to fix this issue, I tend to always keep a live-USB at hand for if/when things like this happen.
Fortunately, that seems to have worked. I'll try building busybox
with your commit and that patch in a bit.
Blindly patching the above link didn't work, but I'll look into why in a couple of hours.
In the meantime, another thing of interest is wyverkiss's busybox/build
. This package contains no patch files not in the KISS package.
I toyed around for a bit, and the only time I was able to get a build that worked was with wyverkiss's busybox/build
as-is. This includes all four sed
commands, not forcing gcc
by using sed
to turn it into $CC
or cc
, and the export CFLAGS=
.
I was surprised about the export CFLAGS=
part being required and I tried to see if it was just one flag I had set that was the actual issue. My ~/.profile
contains export CFLAGS="-Os -march=native -pipe"
. I tried building busybox
with just one of the flags at a time, but I got a segfault for all of them.
Perhaps the KISS build could have something similar to the following:
# Check if using a different compiler than gcc to build.
if [ "$(readlink -f "${CC:-/usr/bin/cc}")" != /usr/bin/gcc ]; then
# Remove forced gcc usage so builds work on gcc-less systems.
sed -i "s#= gcc#= ${CC:-cc}#g" Makefile
sed -i "s#\(\$(CROSS_COMPILE)\)gcc#\1${CC:-cc}#g" Makefile
# See http://lists.busybox.net/pipermail/busybox/2019-October/087558.html
sed -i -e 's:-static-libgcc::' Makefile.flags
sed -i -r -e 's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|finline-limit=0|fomit-frame-pointer)\>::g' Makefile.flags
sed -i '/^#error Aborting compilation./d' applets/applets.c
sed -i 's:-Wl,--gc-sections::' Makefile
export CFLAGS=
fi
If you notice, I replaced g[c+][c+]
with gcc
because the g++
line in Makefile
isn't harmful.
Yeah... not going to add this to the build file.
readlink
is not POSIX (only the C function is).if
check bypasses the user's $PATH
. $CC
is set to XXX
rather then /path/to/XXX
the if
will fail (readlink -f gcc
for example prints nothing).-static-libgcc
just fine (it may even alias it to the clang/llvm equivalent. I recall seeing PRs for this upstream). I don't think there's a reason for stripping it out. This also affects KISS' clang directly.sed -i '/^#error Aborting compilation./d' applets/applets.c
does nothing as the file does not contain what we're removing.These changes butcher things far too much. I'd rather see the issues fixed via a patch with conditionals for clang in Makefile.flags
and Makefile
. Example: https://git.busybox.net/busybox/commit/?id=505eeae402a84dc5208986c5ad611f5e485cbe34 This has the added benefit of being eligible for inclusion upstream (where the issue can be solved one and for all).
OK. Makefile.flags already has some Clang support and omits the following CFLAGS
:;
-static-libgcc
ifneq ($(CC),clang)
# "clang-9: warning: argument unused during compilation: '-static-libgcc'"
CFLAGS += $(call cc-option,-static-libgcc,)
endif
-falign-jumps=1
, -falign-labels=1
, -falign-loops=1
ifneq ($(CC),clang)
# "clang-9: warning: optimization flag '-falign-jumps=1' is not supported" (and same for other two)
CFLAGS += $(call cc-option,-falign-jumps=1 -falign-labels=1 -falign-loops=1,)
endif
-Wno-string-plus-int -Wno-constant-logical-operand
Does this snippet contain a typo? ifeq
should be ifneq
??
# clang-9 does not like "str" + N and "if (CONFIG_ITEM && cond)" constructs
ifeq ($(CC),clang)
CFLAGS += $(call cc-option,-Wno-string-plus-int -Wno-constant-logical-operand)
endif
-finline-limit=0
ifneq ($(CC),clang)
# "clang-9: warning: optimization flag '-finline-limit=0' is not supported
CFLAGS += $(call cc-option,-finline-limit=0,)
endif
Regarding items 4, 5, and 6, these were all needed for me to build busybox
without sh
segfaulting.
This detection still assumes that cc
equates to gcc
. One must explicitly set CC
to clang
. We could patch this to properly detect clang in all cases.
@trbednarzyk Yeah. If we fix the detection of clang, 5 can be removed. 6 makes no sense to me as the file doesn't contain the pattern we're stripping from it.
I guess earlier I must've had something else disabled when I disabled item 6 earlier. I rebuilt busybox
with item 6 disabled and it works.
OK. When CC=clang
, all problematic CFLAGS
are removed except for -fomit-frame-pointer
, -falign-functions=1
and -Os
(though I want this working with optimizations enabled). -Wl,--gc-sections
was also omitted.
I think this issue is more about supporting busybox + clang when CC=cc
. Upstream only check that CC=clang
. There are still those two hardcoded gcc
calls but the CFLAGS stuff shouldn't be needed once clang detection is made more robust.
I guess for detecting clang we could see if the output of ${CC:-cc} -v
starts with clang
and then if it does set CC=clang
.
OK. I can reproduce the segfaults now.
This list contains each utility which segfaults on startup with valgrind memcheckk output alongside. I also only checked './utility' and no further. This was simply to gauge the extent of the issues (and open a potential road to fixing this properly).
Busybox compiled with the following example code (will be changed before inclusion in repositories) and KISS_STRIP=0 CC=clang CFLAGS="$CFLAGS -g"
:
# Remove forced gcc/g++ usage so builds work on gcc-less systems.
sed -i "s#= g[c+][c+]#= ${CC:-cc}#g" Makefile
sed -i "s#\(\$(CROSS_COMPILE)\)gcc#\1${CC:-cc}#g" Makefile
# Disable stripping via fake strip utility (100% there is a better way to do this. Just a lazy solution for testing purposes).
mkdir -p fake_bin
cat <<EOF > fake_bin/strip
#!/bin/sh
cp -f busybox_unstripped busybox
EOF
chmod +x fake_bin/strip
export PATH=$PWD/fake_bin:$PATH
# Strip '-march' from 'CFLAGS' as per advice from upstream.
# Fixes runtime segfaults with clang.
CFLAGS=$(printf %s "$CFLAGS" | sed 's/-march=[^ ]*//g')
CXXFLAGS=$(printf %s "$CXXFLAGS" | sed 's/-march=[^ ]*//g')
List:
arping
(Fixed by stripping -march= from CFLAGS)==2657== Invalid write of size 4
==2657== at 0x12CB72: arping_main (arping.c:303)
==2657== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2657== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2657== by 0x115B00: main (appletlib.c:1151)
==2657== Address 0x30 is not stack'd, malloc'd or (recently) free'd
ash
==27364== Invalid write of size 4
==27364== at 0x15F4FB: ash_main (ash.c:14395)
==27364== by 0x115AC3: run_applet_no_and_exit (appletlib.c:999)
==27364== by 0x115B44: run_applet_and_exit (appletlib.c:1017)
==27364== by 0x115B10: main (appletlib.c:1151)
==27364== Address 0x4 is not stack'd, malloc'd or (recently) free'd
awk
(Fixed by stripping -march= from CFLAGS)==2669== Invalid write of size 4
==2669== at 0x19AF0D: awk_main (awk.c:3210)
==2669== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2669== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2669== by 0x115B00: main (appletlib.c:1151)
==2669== Address 0xc0 is not stack'd, malloc'd or (recently) free'd
bc
==2681== Invalid write of size 4
==2681== at 0x1B262C: read_line_input (lineedit.c:2366)
==2681== by 0x12450E: xc_read_line (bc.c:2549)
==2681== by 0x125655: peek_inbuf (bc.c:2828)
==2681== by 0x11F76F: zxc_lex_next (bc.c:2983)
==2681== by 0x11BF4D: zxc_parse_text_init (bc.c:3634)
==2681== by 0x11BF4D: zxc_vm_process (bc.c:6896)
==2681== by 0x11BE07: zxc_vm_execute_FILE (bc.c:7007)
==2681== by 0x11BE07: zxc_vm_exec (bc.c:7305)
==2681== by 0x11BE07: xc_vm_run (bc.c:7424)
==2681== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2681== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2681== by 0x115B00: main (appletlib.c:1151)
==2681== Address 0x8 is not stack'd, malloc'd or (recently) free'd
dc
==2689== Invalid write of size 4
==2689== at 0x1B262C: read_line_input (lineedit.c:2366)
==2689== by 0x12450E: xc_read_line (bc.c:2549)
==2689== by 0x125655: peek_inbuf (bc.c:2828)
==2689== by 0x11F76F: zxc_lex_next (bc.c:2983)
==2689== by 0x11BF4D: zxc_parse_text_init (bc.c:3634)
==2689== by 0x11BF4D: zxc_vm_process (bc.c:6896)
==2689== by 0x11BE07: zxc_vm_execute_FILE (bc.c:7007)
==2689== by 0x11BE07: zxc_vm_exec (bc.c:7305)
==2689== by 0x11BE07: xc_vm_run (bc.c:7424)
==2689== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2689== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2689== by 0x115B00: main (appletlib.c:1151)
==2689== Address 0x8 is not stack'd, malloc'd or (recently) free'd
diff
(Fixed by stripping -march= from CFLAGS)==2703== Invalid write of size 4
==2703== at 0x19FF56: diff_main (diff.c:982)
==2703== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2703== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2703== by 0x115B00: main (appletlib.c:1151)
==2703== Address 0x4 is not stack'd, malloc'd or (recently) free'd
ed
==2711== Invalid write of size 4
==2711== at 0x1A19CB: ed_main (ed.c:998)
==2711== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2711== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2711== by 0x115B00: main (appletlib.c:1151)
==2711== Address 0xc is not stack'd, malloc'd or (recently) free'd
fdisk
(Fixed by stripping -march= from CFLAGS)==2721== Invalid write of size 4
==2721== at 0x170FBB: fdisk_main (fdisk.c:3034)
==2721== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2721== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2721== by 0x115B00: main (appletlib.c:1151)
==2721== Address 0x18 is not stack'd, malloc'd or (recently) free'd
ftpd
(Fixed by stripping -march= from CFLAGS)==2733== Invalid write of size 4
==2733== at 0x12EE51: ftpd_main (ftpd.c:1187)
==2733== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2733== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2733== by 0x115B00: main (appletlib.c:1151)
==2733== Address 0xc is not stack'd, malloc'd or (recently) free'd
getty
(Fixed by stripping -march= from CFLAGS)==2737== Invalid write of size 8
==2737== at 0x119471: getty_main (getty.c:557)
==2737== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2737== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2737== by 0x115B00: main (appletlib.c:1151)
==2737== Address 0x8 is not stack'd, malloc'd or (recently) free'd
hexedit
(Fixed by stripping -march= from CFLAGS)==2741== Invalid write of size 4
==2741== at 0x116AE0: get_terminal_width_height (xfuncs.c:290)
==2741== by 0x126AB9: hexedit_main (hexedit.c:267)
==2741== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2741== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2741== by 0x115B00: main (appletlib.c:1151)
==2741== Address 0x8 is not stack'd, malloc'd or (recently) free'd
httpd
(Fixed by stripping -march= from CFLAGS)==2748== Invalid write of size 8
==2748== at 0x130962: httpd_main (httpd.c:2678)
==2748== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2748== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2748== by 0x115B00: main (appletlib.c:1151)
==2748== Address 0x58 is not stack'd, malloc'd or (recently) free'd
ifplugd
(Fixed by stripping -march= from CFLAGS)==2754== at 0x133D61: ifplugd_main (ifplugd.c:573)
==2754== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2754== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2754== by 0x115B00: main (appletlib.c:1151)
==2754== Address 0x0 is not stack'd, malloc'd or (recently) free'd
less
(Fixed by stripping -march= from CFLAGS)==2758== Invalid write of size 4
==2758== at 0x1273AA: less_main (less.c:1812)
==2758== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2758== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2758== by 0x115B00: main (appletlib.c:1151)
==2758== Address 0xc is not stack'd, malloc'd or (recently) free'd
makemime
(Fixed by stripping -march= from CFLAGS)==2765== Invalid write of size 8
==2765== at 0x119E1B: makemime_main (makemime.c:191)
==2765== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2765== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2765== by 0x115B00: main (appletlib.c:1151)
==2765== Address 0x28 is not stack'd, malloc'd or (recently) free'd
mpstat
(Fixed by stripping -march= from CFLAGS)==2768== Invalid write of size 4
==2768== at 0x153208: mpstat_main (mpstat.c:860)
==2768== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2768== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2768== by 0x115B00: main (appletlib.c:1151)
==2768== Address 0x0 is not stack'd, malloc'd or (recently) free'd
netstat
(Fixed by stripping -march= from CFLAGS)==2776== Invalid write of size 1
==2776== at 0x13AC61: netstat_main (netstat.c:689)
==2776== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2776== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2776== by 0x115B00: main (appletlib.c:1151)
==2776== Address 0x0 is not stack'd, malloc'd or (recently) free'd
nmeter
(Fixed by stripping -march= from CFLAGS)==2779== Invalid write of size 8
==2779== at 0x1548C9: nmeter_main (nmeter.c:866)
==2779== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2779== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2779== by 0x115B00: main (appletlib.c:1151)
==2779== Address 0x8 is not stack'd, malloc'd or (recently) free'd
nologin
==2786== Invalid write of size 4
==2786== at 0x15F8B3: ash_main (ash.c:14395)
==2786== by 0x11586E: scripted_main (appletlib.c:781)
==2786== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2786== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2786== by 0x115B00: main (appletlib.c:1151)
==2786== Address 0x4 is not stack'd, malloc'd or (recently) free'd
popmaildir
(Fixed by stripping -march= from CFLAGS)==2788== Invalid write of size 8
==2788== at 0x119F92: popmaildir_main (popmaildir.c:125)
==2788== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2788== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2788== by 0x115B00: main (appletlib.c:1151)
==2788== Address 0x28 is not stack'd, malloc'd or (recently) free'd
reformime
(Fixed by stripping -march= from CFLAGS)==2790== Invalid write of size 8
==2790== at 0x11A42A: reformime_main (reformime.c:279)
==2790== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2790== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2790== by 0x115B00: main (appletlib.c:1151)
==2790== Address 0x28 is not stack'd, malloc'd or (recently) free'd
sendmail
(Fixed by stripping -march= from CFLAGS)==2793== Invalid write of size 8
==2793== at 0x11AA93: sendmail_main (sendmail.c:258)
==2793== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2793== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2793== by 0x115B00: main (appletlib.c:1151)
==2793== Address 0x28 is not stack'd, malloc'd or (recently) free'd
svlogd
(Fixed by stripping -march= from CFLAGS)==2798== Invalid write of size 4
==2798== at 0x15D75D: svlogd_main (svlogd.c:1046)
==2798== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2798== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2798== by 0x115B00: main (appletlib.c:1151)
==2798== Address 0xc is not stack'd, malloc'd or (recently) free'd
test
==2801== Invalid write of size 8
==2801== at 0x4089DD6: ??? (setjmp.s:11)
==2801== by 0x197B91: test_main (test.c:851)
==2801== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2801== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2801== by 0x115B00: main (appletlib.c:1151)
==2801== Address 0x20 is not stack'd, malloc'd or (recently) free'd
top
(Fixed by stripping -march= from CFLAGS)==2804== Invalid write of size 8
==2804== at 0x158FDC: top_main (top.c:1117)
==2804== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2804== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2804== by 0x115B00: main (appletlib.c:1151)
==2804== Address 0x128 is not stack'd, malloc'd or (recently) free'd
vi
(Fixed by stripping -march= from CFLAGS)==2811== Invalid write of size 4
==2811== at 0x1A5357: vi_main (vi.c:4322)
==2811== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2811== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2811== by 0x115B00: main (appletlib.c:1151)
==2811== Address 0x24 is not stack'd, malloc'd or (recently) free'd
wget
(Fixed by stripping -march= from CFLAGS)==2816== Invalid write of size 4
==2816== at 0x1488F7: wget_main (wget.c:1478)
==2816== by 0x115AB3: run_applet_no_and_exit (appletlib.c:999)
==2816== by 0x115B34: run_applet_and_exit (appletlib.c:1017)
==2816== by 0x115B00: main (appletlib.c:1151)
==2816== Address 0x84 is not stack'd, malloc'd or (recently) free'd
Affected lines of code (shared code, excluding the main.c for each utility):
file | line |
---|---|
scripted_main (appletlib.c:781) |
exit(ash_main(-script - 1, argv)); |
run_applet_no_and_exit (appletlib.c:999) |
xfunc_error_retval = applet_main[applet_no](argc, argv); |
run_applet_and_exit (appletlib.c:1017) |
run_applet_no_and_exit(applet, name, argv); |
main (appletlib.c:1151) |
run_applet_and_exit(applet_name, argv) |
get_terminal_width_height (xfuncs.c:290) |
*height = wh_helper(win.ws_row, 24, "LINES", &err); |
read_line_input (lineedit.c:2366) |
INIT_S(); |
Finding affected lines in each utility is trickier as line numbers from valgrind don't equate to line numbers in the source due to the use of ifdefs, etc. Regardless, the above should suffice for nearly all segfaulting utilities.
There's a lot of fuckery with a macro called INIT_G()
which is copy/pasted + modified in all(?) of the utility C files.
Example:
/* This struct is deliberately not defined. */
/* See docs/keep_data_small.txt */
struct globals;
#define G (*ptr_to_globals)
#define INIT_G() do { \
setup_common_bufsiz(); \
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
linemax = 1000; \
/*buflen = 1024;*/ \
linecomplete = 1; \
replace = ""; \
} while (0)
ptr_to_globals
is defined in include/libbb.h
/* '*const' ptr makes gcc optimize code much better.
* Magic prevents ptr_to_globals from going into rodata.
* If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */
extern struct globals *const ptr_to_globals;
SET_PTR_TO_GLOBALS
is defined in include/libbb.h
/* At least gcc 3.4.6 on mipsel system needs optimization barrier */
#define barrier() __asm__ __volatile__("":::"memory")
#define SET_PTR_TO_GLOBALS(x) do { \
(*(struct globals**)not_const_pp(&ptr_to_globals)) = (void*)(x); \
barrier(); \
} while (0)
not_const_pp
is defined in include/libbb.h
#if defined(__clang_major__) && __clang_major__ >= 9
/* Clang/llvm drops assignment to "constant" storage. Silently.
* Needs serious convincing to not eliminate the store.
*/
static ALWAYS_INLINE void* not_const_pp(const void *p)
{
void *pp;
__asm__ __volatile__(
"# forget that p points to const"
: /*outputs*/ "=r" (pp)
: /*inputs*/ "0" (p)
);
return pp;
}
#else
static ALWAYS_INLINE void* not_const_pp(const void *p) { return (void*)p; }
#endif
setup_common_bufsiz()
is defined in libbb/common_bufsize.c
#if !ENABLE_FEATURE_USE_BSS_TAIL
/* We use it for "global" data via *(struct global*)bb_common_bufsiz1.
* Since gcc insists on aligning struct global's members, it would be a pity
* (and an alignment fault on some CPUs) to mess it up. */
char bb_common_bufsiz1[COMMON_BUFSIZE] ALIGNED(sizeof(long long));
#else
# ifndef setup_common_bufsiz
/* For now, this is never used:
* scripts/generate_BUFSIZ.sh never generates "malloced" bufsiz1:
* enum { COMMON_BUFSIZE = 1024 };
* extern char *const bb_common_bufsiz1;
* void setup_common_bufsiz(void);
* This has proved to be worse than the approach of defining
* larger bb_common_bufsiz1[] array.
*/
/*
* It is not defined as a dummy macro.
* It means we have to provide this function.
*/
char *const bb_common_bufsiz1 __attribute__ ((section (".data")));
void setup_common_bufsiz(void)
{
if (!bb_common_bufsiz1)
*(char**)&bb_common_bufsiz1 = xzalloc(COMMON_BUFSIZE);
}
# else
# ifndef bb_common_bufsiz1
/* bb_common_bufsiz1[] is not aliased to _end[] */
char bb_common_bufsiz1[COMMON_BUFSIZE] ALIGNED(sizeof(long long));
# endif
# endif
#endif
OK! Discovered that the majority of the broken utilities work once -march=
is stripped from CFLAGS. A fine compromise compared to disabling optimization altogether.
List updated in this comment: https://github.com/kisslinux/repo/issues/240#issuecomment-730145697
Still broken utilities:
ash
bc
dc
ed
nologon
test
OK. Pushed the bulk of the changes (read my commit message). https://github.com/kisslinux/repo/commit/eb412f08f5a58bc8a70fb21abf4da1f034eddaf4
You can test with CC=clang kiss b busybox
. Fixes for ln -s clang cc
coming a little later today (have errands to run first)
Please let me know if the issue still occurs. I can no longer reproduce. :)
Got an error with the Makefile:
patching file loginutils/adduser.c
patching file coreutils/test.c
patching file include/libbb.h
patching file libbb/lineedit.c
patching file shell/ash.c
patching file e2fsprogs/fsck.c
patching file coreutils/install.c
patching file util-linux/lsusb.c
patching file modutils/modprobe.c
patching file libbb/printable_string.c
patching file archival/unzip.c
/bin/sh: syntax error: unterminated quoted string
make: *** [Makefile:784: .kernelrelease] Error 2
Interestingly... I cannot reproduce.
What's your $CC
set to (if set)?
My $CC
is not set (empty).
EDIT: Nevermind. Forgot to mount the trio of /dev
, /proc
, and /sys
.
Works good on my end.
Continuing discussion from https://github.com/konimex/kiss-llvm/pull/3.
After I saw @dylanaraps's message there, I rebuilt and installed
busybox
using the package inrepo/core
. It compiled fine but now my system seems to be borked askiss
segfaults every time I run it (even to just print the help text).