From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: undefined reference to `raise' with musl static toolchain
Date: Wed, 9 May 2018 15:44:07 +0200 [thread overview]
Message-ID: <20180509154407.1164eb41@windsurf.home> (raw)
In-Reply-To: <20180509112932.1a3176b0@windsurf.home>
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@build:~/outputs/uclibc-static$ cat foo.c
int main(void) { mktime(); return 0; }
test@build:~/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-a
8 --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@build:~/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@build:~/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
next prev parent reply other threads:[~2018-05-09 13:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-08 12:44 Thomas Petazzoni
2018-05-08 13:28 ` Alexander Monakov
2018-05-08 16:22 ` Markus Wichmann
2018-05-08 16:34 ` Rich Felker
2018-05-09 9:29 ` Thomas Petazzoni
2018-05-09 13:44 ` Thomas Petazzoni [this message]
2018-05-09 15:24 ` Szabolcs Nagy
2018-05-09 17:28 ` Rich Felker
2018-05-11 15:59 ` Thomas Petazzoni
2018-05-11 16:05 ` Rich Felker
2018-05-11 21:28 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180509154407.1164eb41@windsurf.home \
--to=thomas.petazzoni@bootlin.com \
--cc=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).