Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 20 Sep 2012 16:50:13 +0200 (CEST)
From: Jens <jensl@...s.mine.nu>
To: musl@...ts.openwall.com
Subject: musl-gcc question


Hello!

Looks like musl-gcc in my uclibc environment doesn't work correctly (for 
me):

bash-4.1# cat t.c
main()
{
 	printf("hejsan!\n");
}
bash-4.1# gcc -o t -static t.c
t.c: In function 'main':
t.c:3: warning: incompatible implicit declaration of built-in function 
'printf'
bash-4.1# musl-gcc -o m -static t.c
t.c: In function 'main':
t.c:3: warning: incompatible implicit declaration of built-in function 
'printf'
bash-4.1# ls -l t m
-rwxr-xr-x    1 0        0           17637 Sep 20 14:43 m
-rwxr-xr-x    1 0        0           17637 Sep 20 14:43 t
bash-4.1# cmp t m
bash-4.1#

If I try this:

bash-4.1# gcc -nostdinc -isystem /opt/musl/include -nostdlib 
-L/opt/musl/lib -o m /opt/musl/lib/crti.o  /opt/musl/lib/crtn.o 
/opt/musl/lib/Scrt1.o -lc -static t.c
t.c: In function 'main':
t.c:3: warning: incompatible implicit declaration of built-in function 
'printf'
bash-4.1# ls -l t m
-rwxr-xr-x    1 0        0           63217 Sep 20 14:44 m
-rwxr-xr-x    1 0        0           17637 Sep 20 14:43 t
bash-4.1# strip t m
bash-4.1# ls -l t m
-rwxr-xr-x    1 0        0            5152 Sep 20 14:44 m
-rwxr-xr-x    1 0        0            8424 Sep 20 14:44 t

Looks like 'm' is now actually build with musl.

If we look at the verbose output below it seems like -L/lib is a bad thing 
to have, since all the uclibc libs are there.

musl is installed under /opt/musl.

What have I missed?

I have tested musl-0.9.1 and musl-0.9.6.

Regards,
Jens

bash-4.1# musl-gcc -v -o m -static t.c
Invoked as gcc
Reference path: /bin/..
arg[ 0] = rawgcc
arg[ 1] = -nostdlib
arg[ 2] = -static
arg[ 3] = -Wl,-rpath-link,/bin/../lib
arg[ 4] = -L/bin/../lib
arg[ 5] = -L/bin/../gcc/lib
arg[ 6] = -nostdinc
arg[ 7] = -isystem
arg[ 8] = /bin/../include
arg[ 9] = -isystem
arg[10] = /bin/../gcc/include
arg[11] = -U__nptl__
arg[12] = /bin/../lib/crti.o
arg[13] = /bin/../gcc/lib/crtbeginT.o
arg[14] = /bin/../lib/crt1.o
arg[15] = -v
arg[16] = -o
arg[17] = m
arg[18] = -static
arg[19] = t.c
arg[20] = -specs
arg[21] = /opt/musl/lib/musl-gcc.specs
arg[22] = -lgcc
arg[23] = -lgcc_eh
arg[24] = -lc
arg[25] = -lgcc
arg[26] = -lgcc_eh
arg[27] = /bin/../gcc/lib/crtend.o
arg[28] = /bin/../lib/crtn.o
Using built-in specs.
Reading specs from /opt/musl/lib/musl-gcc.specs
rename spec cpp_options to old_cpp_options
Target: x86_64-unknown-linux
Configured with: 
/home/landley/firmware-0.9.6/build/temp-x86_64/gcc-core/configure 
--prefix=/home/landley/firmware-0.9.6/build/mini-native-x86_64/usr 
--disable-multilib --build=x86_64-walrus-linux --host=x86_64-unknown-linux 
--target=x86_64-unknown-linux --enable-long-long --enable-c99 
--enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-nls 
--enable-languages=c,c++ --disable-libstdcxx-pch --enable-sjlj-exceptions 
--program-prefix=
Thread model: posix
gcc version 4.1.2
  /usr/bin/../libexec/gcc/x86_64-unknown-linux/4.1.2/cc1 -quiet -nostdinc 
-v -iprefix /usr/bin/../lib/gcc/x86_64-unknown-linux/4.1.2/ -U__nptl__ 
-isystem /bin/../include -isystem /bin/../gcc/include t.c -nostdinc 
-isystem /opt/musl/include -quiet -dumpbase t.c -mtune=k8 -auxbase t 
-version -o /tmp/ccv5P4ov.s
#include "..." search starts here:
#include <...> search starts here:
  /bin/../include
  /bin/../gcc/include
  /opt/musl/include
End of search list.
GNU C version 4.1.2 (x86_64-unknown-linux)
 	compiled by GNU C version 4.1.2.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 02dced53fb1afdc2e565976e418928e8
t.c: In function 'main':
t.c:3: warning: incompatible implicit declaration of built-in function 
'printf'
  as --traditional-format -V -Qy -o /tmp/ccW901pW.o /tmp/ccv5P4ov.s
GNU assembler version 2.17 (x86_64-unknown-linux) using BFD version 2.17
  /usr/bin/../libexec/gcc/x86_64-unknown-linux/4.1.2/collect2 
-dynamic-linker /lib/ld-musl-x86_64.so.1 -nostdlib -static -o m 
-L/bin/../lib -L/bin/../gcc/lib -L/opt/musl/lib -L /lib/. -rpath-link 
/bin/../lib /bin/../lib/crti.o /bin/../gcc/lib/crtbeginT.o 
/bin/../lib/crt1.o /tmp/ccW901pW.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh 
/bin/../gcc/lib/crtend.o /bin/../lib/crtn.o

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.