Re: Toybox make root no longer works as expected
Rob Landley <[email protected]>
| Newsgroups | gmane.linux.ports.sh.devel |
|---|---|
| Message-ID | <[email protected]> |
On 5/11/26 18:08, Rob Landley wrote:
> The end of line not at end of file, missing operand, and invalid
> operands for opcode seem relevant, and the fact it's happening in the
> middle of a nested macro expansion implies that the code being fed into
> the actual compiler plumbing may be nuts here, but I'd have to cc -E and
> then cc -S the result to see what actually happens.
The barfing compiler invocation is:
sh2eb-linux-muslfdpic-gcc -nostdinc \
-I./arch/sh/include -I./arch/sh/include/generated -I./include
-I./include -I./arch/sh/include/uapi -I./arch/sh/include/generated/uapi
-I./include/uapi -I./include/generated/uapi -include
./include/linux/compiler-version.h -include ./include/linux/kconfig.h
-include ./include/linux/compiler_types.h -D__KERNEL__ -I
./arch/sh/include/cpu-sh2 -I ./arch/sh/include/cpu-common -I
./arch/sh/include/mach-common \
-std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE
-fno-strict-aliasing -pipe -m2 -mj2 -mb -mno-fdpic -Wa,-isa=sh2-up
-ffreestanding -fno-delete-null-pointer-checks -O2
-fno-allow-store-data-races -fno-stack-protector -fomit-frame-pointer
-fno-stack-clash-protection -fno-strict-overflow -fno-stack-check
-fconserve-stack -fno-builtin-wcslen \
-Wall -Wextra -Wundef -Werror=implicit-function-declaration
-Werror=implicit-int -Werror=return-type -Werror=strict-prototypes
-Wno-format-security -Wno-trigraphs -Wno-frame-address
-Wno-address-of-packed-member -Wmissing-declarations
-Wmissing-prototypes -Wframe-larger-than=1024 -Wno-main
-Wvla-larger-than=1 -Wno-pointer-sign -Wcast-function-type
-Wno-array-bounds -Wno-stringop-overflow -Wno-alloc-size-larger-than
-Wimplicit-fallthrough=5 -Werror=date-time
-Werror=incompatible-pointer-types -Werror=designated-init
-Wenum-conversion -Wunused -Wno-unused-but-set-variable
-Wno-unused-const-variable -Wno-packed-not-aligned -Wno-format-overflow
-Wno-format-truncation -Wno-stringop-truncation -Wno-override-init
-Wno-missing-field-initializers -Wno-type-limits
-Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare
-Wno-unused-parameter \
-DKBUILD_MODFILE='"kernel/nstree"' -DKBUILD_BASENAME='"nstree"'
-DKBUILD_MODNAME='"nstree"' -D__KBUILD_MODNAME=kmod_nstree \
-c -o kernel/nstree.o kernel/nstree.c
I turned the -c into a -E to get a preprocessed file, and since -E ate
all the -I and -D you compile THAT with just:
sh2eb-linux-muslfdpic-cc -std=gnu11 -fshort-wchar -funsigned-char
-fno-common -fno-PIE -fno-strict-aliasing -pipe -m2 -mj2 -mb -mno-fdpic
-Wa,-isa=sh2-up -ffreestanding -fno-delete-null-pointer-checks -O2
-fno-allow-store-data-races -fno-stack-protector -fomit-frame-pointer
-fno-stack-clash-protection -fno-strict-overflow -fno-stack-check
-fconserve-stack -fno-builtin-wcslen -c nstree-pre.c nstree.o
And even though that says it's barfing on line 1640, which is the
declaration of raw_atomic_sub_return_relaxed, if you delete all the
functions after that in the file it doesn't fail. In fact, if I delete
JUST the last function from the file, it succeeds.
Let's try ripping out some of the decorators:
sed -i -E
's/__attribute__\(\(__(always_inline|unused|gnu_inline|no_instrument_function|always_inline|warn_unused_result)__\)\)//g'
nstree-pre2.c
Still dies.
sed -i 's/static inline/static/g' nstree-pre2.c
Still dies.
Hmmm, still a 2.1 megabyte file, bit much to attach here. Let's see...
I switched to -S instead of -c and got
during RTL pass: final
kernel/nstree.c: In function '__se_sys_listns':
kernel/nstree.c:729:3236: internal compiler error: in change_address_1,
at emit-rtl.c:2275
729 | SYSCALL_DEFINE4(listns, const struct ns_id_req __user *, req,
|
Which is because all those "# 123" lines in the -E output, lemme strip
those and...
nstree-pre2.c:62345:8: warning: 'sys_listns' alias between functions of
incompatible types 'long int(const struct ns_id_req *, u64 *, size_t,
unsigned int)' {aka 'long int(const struct ns_id_req *, long long
unsigned int *, unsigned int, unsigned int)'} and 'long int(long int,
long int, long int, long int)' [-Wattribute-alias=]
Huh? (I mean it's been doing a lot of warnings because I dropped the
-Wno-gnu-stupid section, but now we're down to one and it seems
potentially relevant? Anyway...
during RTL pass: final
nstree-pre2.c: In function '__se_sys_listns':
nstree-pre2.c:62345:3236: internal compiler error: in change_address_1,
at emit-rtl.c:2275
62345 | d int) > sizeof(long)" " is true");})); do { } while (0); return
ret; }
|
3236 is the closing curly bracket on giant line. And again, if I delete
everyting AFTER that line it works. Stick in a newline at each semicolon
(and zap the silly #pragma gnu debug pop whatever that is) and... It
complains that the last curly bracket of the file is the problem now.
I think maybe it's trying to inline __do_sys_listns() into sys_listns()
but, sticking __attribute__((noinline)) on both the declaration and the
definition changed nothing. :(
What does kernel/nstree.c do, anyway? It's a large lump of added code
making the kernel bigger, but there's no config symbol I can switch off
to remove it (kernel/Makefile has it in obj-y unconditionally). But
that's modern Linux for you. Bigger and bigger...
Rob