|
Message-ID: <20180509154407.1164eb41@windsurf.home> Date: Wed, 9 May 2018 15:44:07 +0200 From: Thomas Petazzoni <thomas.petazzoni@...tlin.com> To: Rich Felker <dalias@...c.org> Cc: musl@...ts.openwall.com Subject: Re: undefined reference to `raise' with musl static toolchain Hello Rich, On Wed, 9 May 2018 11:29:32 +0200, Thomas Petazzoni wrote: > I'm doing a build to confirm, but I don't think we have the same > requirement with uClibc-ng. A uClibc-ng toolchain works fine without the explicit -static: test@...ld:~/outputs/uclibc-static$ cat foo.c int main(void) { mktime(); return 0; } test@...ld:~/outputs/uclibc-static$ ./host/bin/arm-linux-gcc -o foo foo.c -v Using built-in specs. COLLECT_GCC=/home/test/outputs/uclibc-static/host/bin/arm-linux-gcc.br_real COLLECT_LTO_WRAPPER=/home/test/outputs/uclibc-static/host/libexec/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/lto-wrapper Target: arm-buildroot-linux-uclibcgnueabihf Configured with: ./configure --prefix=/home/test/outputs/uclibc-static/host --sysconfdir=/home/test/outputs/uclibc-static/host/etc --enable-static --target=arm-buildroot-linux-uclibcgnueabihf --with-sysroot=/home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot --disable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --with-gmp=/home/test/outputs/uclibc-static/host --with-mpc=/home/test/outputs/uclibc-static/host --with-mpfr=/home/test/outputs/uclibc-static/host --with-pkgversion='Buildroot 2018.05-git-01130-gd007bca' --with-bugurl=http://bugs.buildroot.net/ --disable-libquadmath --disable-libsanitizer --enable-tls --disable-libmudflap --enable-threads --without-isl --without-cloog --disable-decimal-float --with-abi=aapcs-linux --with-cpu=cortex-a8 --with-fpu=vfpv3-d16 --with-float=hard --with-mode=arm --enable-languages=c,c++ --with-build-time-tools=/home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/bin --disable-shar ed --disable-libcilkrts --disable-libgomp Thread model: posix gcc version 6.4.0 (Buildroot 2018.05-git-01130-gd007bca) COLLECT_GCC_OPTIONS='-o' 'foo' '-v' '-mcpu=cortex-a8' '-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-mabi=aapcs-linux' '-marm' '-mtls-dialect=gnu' /home/test/outputs/uclibc-static/host/libexec/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/cc1 -quiet -v -isysroot /home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot foo.c -quiet -dumpbase foo.c -mcpu=cortex-a8 -mfloat-abi=hard -mfpu=vfpv3-d16 -mabi=aapcs-linux -marm -mtls-dialect=gnu -auxbase foo -version -o /tmp/ccrBk49l.s GNU C11 (Buildroot 2018.05-git-01130-gd007bca) version 6.4.0 (arm-buildroot-linux-uclibcgnueabihf) compiled by GNU C version 4.7.2, GMP version 6.1.2, MPFR version 3.1.6, MPC version 1.0.3, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/local/include" #include "..." search starts here: #include <...> search starts here: /home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/include /home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/include-fixed /home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/../../../../arm-buildroot-linux-uclibcgnueabihf/include /home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/include End of search list. GNU C11 (Buildroot 2018.05-git-01130-gd007bca) version 6.4.0 (arm-buildroot-linux-uclibcgnueabihf) compiled by GNU C version 4.7.2, GMP version 6.1.2, MPFR version 3.1.6, MPC version 1.0.3, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 64d3b70b605ed06af58d56698f38a6fa foo.c: In function 'main': foo.c:1:18: warning: implicit declaration of function 'mktime' [-Wimplicit-function-declaration] int main(void) { mktime(); return 0; } ^~~~~~ COLLECT_GCC_OPTIONS='-o' 'foo' '-v' '-mcpu=cortex-a8' '-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-mabi=aapcs-linux' '-marm' '-mtls-dialect=gnu' /home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/../../../../arm-buildroot-linux-uclibcgnueabihf/bin/as -v -mcpu=cortex-a8 -mfloat-abi=hard -mfpu=vfpv3-d16 -meabi=5 -o /tmp/ccVtxQ2w.o /tmp/ccrBk49l.s GNU assembler version 2.29.1 (arm-buildroot-linux-uclibcgnueabihf) using BFD version (GNU Binutils) 2.29.1 COMPILER_PATH=/home/test/outputs/uclibc-static/host/libexec/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/:/home/test/outputs/uclibc-static/host/libexec/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/:/home/test/outputs/uclibc-static/host/libexec/gcc/arm-buildroot-linux-uclibcgnueabihf/:/home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/:/home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/:/home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/../../../../arm-buildroot-linux-uclibcgnueabihf/bin/ LIBRARY_PATH=/home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/:/home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/../../../../arm-buildroot-linux-uclibcgnueabihf/lib/:/home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/lib/:/home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib/ COLLECT_GCC_OPTIONS='-o' 'foo' '-v' '-mcpu=cortex-a8' '-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-mabi=aapcs-linux' '-marm' '-mtls-dialect=gnu' /home/test/outputs/uclibc-static/host/libexec/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/collect2 -plugin /home/test/outputs/uclibc-static/host/libexec/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/liblto_plugin.so -plugin-opt=/home/test/outputs/uclibc-static/host/libexec/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccbL5nWH.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc --sysroot=/home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot --eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux_eabi -o foo /home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib/crt1.o /home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib/crti.o /home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/crtbegin.o -L/home/test/outputs/uclibc-static/host/lib/gcc/arm-buildro ot-linux-uclibcgnueabihf/6.4.0 -L/home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/../../../../arm-buildroot-linux-uclibcgnueabihf/lib -L/home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/lib -L/home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib /tmp/ccVtxQ2w.o -lgcc -lc -lgcc /home/test/outputs/uclibc-static/host/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/6.4.0/crtend.o /home/test/outputs/uclibc-static/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib/crtn.o COLLECT_GCC_OPTIONS='-o' 'foo' '-v' '-mcpu=cortex-a8' '-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-mabi=aapcs-linux' '-marm' '-mtls-dialect=gnu' test@...ld:~/outputs/uclibc-static$ file foo foo: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped And the sysroot really only has a static variant of the C library: test@...ld:~/outputs/uclibc-static$ ls -l staging/lib staging/usr/lib staging/lib: total 68 -rw-r--r-- 1 test test 63630 May 9 09:35 libatomic.a -rwxr-xr-x 1 test test 962 May 9 09:35 libatomic.la staging/usr/lib: total 6368 -rw-r--r-- 1 test test 984 May 9 09:33 crt1.o -rw-r--r-- 1 test test 992 May 9 09:33 crti.o -rw-r--r-- 1 test test 976 May 9 09:33 crtn.o -rw-r--r-- 1 test test 2085880 May 9 09:33 libc.a -rw-r--r-- 1 test test 8 May 9 09:33 libcrypt.a -rw-r--r-- 1 test test 8 May 9 09:33 libdl.a -rw-r--r-- 1 test test 8 May 9 09:33 libiconv.a -rw-r--r-- 1 test test 8 May 9 09:33 libintl.a -rw-r--r-- 1 test test 8 May 9 09:33 libm.a -rw-r--r-- 1 test test 8 May 9 09:33 libnsl.a -rw-r--r-- 1 test test 8 May 9 09:33 libpthread.a -rw-r--r-- 1 test test 8 May 9 09:33 libresolv.a -rw-r--r-- 1 test test 8 May 9 09:33 librt.a -rw-r--r-- 1 test test 4367292 May 9 09:35 libstdc++.a -rw-r--r-- 1 test test 8 May 9 09:33 libutil.a So: why does a musl-based toolchain requires an explicit -static, while it isn't needed with uClibc-ng ? Best regards, Thomas -- Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.