sys-fs/udev fails to build on x86 musl (found during stage3 build) From the log: FAILED: src/udev/v4l_id i686-gentoo-linux-musl-gcc -o src/udev/v4l_id src/udev/v4l_id.p/v4l_id_v4l_id.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-z,now -fstack-protector -Wl,--gc-sections -O2 -march=i68> /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/basic/libbasic.a(log.c.o): in function `create_log_socket': log.c:(.text.create_log_socket+0x10e): undefined reference to `__stack_chk_fail_local' /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/basic/libbasic.a(log.c.o): in function `write_to_journal': log.c:(.text.write_to_journal+0x19c): undefined reference to `__stack_chk_fail_local' /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/basic/libbasic.a(log.c.o): in function `log_open': log.c:(.text.log_open+0x420): undefined reference to `__stack_chk_fail_local' /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/basic/libbasic.a(log.c.o): in function `write_to_console.constprop.0.isra.0': log.c:(.text.write_to_console.constprop.0.isra.0+0x3e4): undefined reference to `__stack_chk_fail_local' /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/basic/libbasic.a(log.c.o): in function `log_dispatch_internal': log.c:(.text.log_dispatch_internal+0x732): undefined reference to `__stack_chk_fail_local' /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/udev/v4l_id.p/v4l_id_v4l_id.c.o:v4l_id.c:(.text.startup.main+0x236): more undefined references to `__s> /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/udev/v4l_id: hidden symbol `__stack_chk_fail_local' isn't defined /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status [389/395] i686-gentoo-linux-musl-gcc -o src/udev/mtd_probe src/udev/mtd_probe.p/mtd_probe_mtd_probe.c.o src/udev/mtd_probe.p/mtd_probe_probe_smartmedia.c.o -Wl,--as-needed -Wl,--no-undefined > FAILED: src/udev/mtd_probe i686-gentoo-linux-musl-gcc -o src/udev/mtd_probe src/udev/mtd_probe.p/mtd_probe_mtd_probe.c.o src/udev/mtd_probe.p/mtd_probe_probe_smartmedia.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-z,rel> /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/basic/libbasic.a(log.c.o): in function `create_log_socket': log.c:(.text.create_log_socket+0x10e): undefined reference to `__stack_chk_fail_local' /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/basic/libbasic.a(log.c.o): in function `write_to_journal': log.c:(.text.write_to_journal+0x19c): undefined reference to `__stack_chk_fail_local' /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/basic/libbasic.a(log.c.o): in function `log_open': log.c:(.text.log_open+0x420): undefined reference to `__stack_chk_fail_local' /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/basic/libbasic.a(log.c.o): in function `write_to_console.constprop.0.isra.0': log.c:(.text.write_to_console.constprop.0.isra.0+0x3e4): undefined reference to `__stack_chk_fail_local' /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/basic/libbasic.a(log.c.o): in function `log_dispatch_internal': log.c:(.text.log_dispatch_internal+0x732): undefined reference to `__stack_chk_fail_local' /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/basic/libbasic.a(log.c.o):log.c:(.text.log_internalv+0x156): more undefined references to `__stack_chk> /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: src/udev/mtd_probe: hidden symbol `__stack_chk_fail_local' isn't defined /usr/lib/gcc/i686-gentoo-linux-musl/10.3.0/../../../../i686-gentoo-linux-musl/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status ... and more ...
This will require x86 linking to libssp_nonshared.a or fixing gcc to properly support using libssp_nonshared.a patch can be provided if you want to test on gcc and then try to emerge udev again.
(In reply to Jory A. Pratt from comment #1) > This will require x86 linking to libssp_nonshared.a or fixing gcc to > properly support using libssp_nonshared.a patch can be provided if you want > to test on gcc and then try to emerge udev again. Not necessarily. You can add CFLAGS="--no-stack-protector" to avoid the call to __stack_chk_fail_local()
Ideally, this test should detect that -fstack-protector does not work properly. https://github.com/systemd/systemd/blob/v249/meson.build#L408 However, the test program meson generates is not complex enough to cause the necessary link failure. > int main(void) { return 0; } blueness came up with the following minimal test program that exhibits the failure: > void f(char *p) { > return ; > } > int main(){ > char a[10]; > f(a) ; > return 0 ; > }
(In reply to Mike Gilbert from comment #3) > Ideally, this test should detect that -fstack-protector does not work > properly. > > https://github.com/systemd/systemd/blob/v249/meson.build#L408 > > However, the test program meson generates is not complex enough to cause the > necessary link failure. > > > int main(void) { return 0; } > > blueness came up with the following minimal test program that exhibits the > failure: > > > void f(char *p) { > > return ; > > } > > int main(){ > > char a[10]; > > f(a) ; > > return 0 ; > > } Actually I have an even smaller program: int main(){ char a[4]; return 0 ; } which fails for `gcc -fstack-protector -o test test.c`. If you decrease the array size below 4, it no longer fails for stack-protector, but does for stack-protector-strong all the way down to 1.
(In reply to Anthony Basile from comment #2) > (In reply to Jory A. Pratt from comment #1) > > This will require x86 linking to libssp_nonshared.a or fixing gcc to > > properly support using libssp_nonshared.a patch can be provided if you want > > to test on gcc and then try to emerge udev again. > > Not necessarily. You can add CFLAGS="--no-stack-protector" to avoid the > call to __stack_chk_fail_local() Well this would work, be easier to support stack_chk_fail_local via the overlay with ssp patch for gcc for x86 users. I am unable to chroot to an x86 setup to do my testing at moment I will try to make it happen before weekend end.
Gcc not links libssp_nonshared.a for all archs.