mailing list of musl libc
 help / color / mirror / code / Atom feed
* musl-gcc vs. BusyBox 1.18.5: multiple definitions of '_start'
@ 2011-07-14 20:24 Isaac Dunham
  2011-07-14 20:28 ` Rich Felker
  2011-07-15 10:01 ` Christian Neukirchen
  0 siblings, 2 replies; 4+ messages in thread
From: Isaac Dunham @ 2011-07-14 20:24 UTC (permalink / raw)
  To: musl

I'm trying to set up a musl-based busybox system, using a version of
musl (d3fd192523db544e6005051f224a2d7bafabedd9) that I pulled from git
just an hour or so ago (prefix=/opt/musl).
My host is Ubuntu 10.04 "Lucid Lynx" with gcc 4.4.3.
When I build busybox 1.18.5 with the default cc (gcc using eglibc), it
compiles appropriately.  But when I use "CC=musl-gcc", compilation fails
at the link step (I did a little patching to get that far, BTW):  
AR util-linux/volume_id/lib.a 
LINK    busybox_unstripped
Trying libraries: crypt m
Failed: -Wl,--start-group -lcrypt -lm -Wl,--end-group
Output of:
musl-gcc -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes
-Wunused -Wunused-parameter -Wunused-function -Wunused-value
-Wmissing-prototypes -Wmissing-declarations
-Wdeclaration-after-statement -Wold-style-definition
-fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer
-ffunction-sections -fdata-sections -fno-guess-branch-probability
-funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1
-falign-labels=1 -falign-loops=1 -Os -march=i386
-mpreferred-stack-boundary=2 -static -o busybox_unstripped
-Wl,--sort-common -Wl,--sort-section,alignment -Wl,--gc-sections
-Wl,--start-group applets/built-in.o archival/lib.a
archival/libarchive/lib.a console-tools/lib.a coreutils/lib.a
coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a
editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a
loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a
networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a
printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shell/lib.a
sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a
archival/built-in.o archival/libarchive/built-in.o
console-tools/built-in.o coreutils/built-in.o
coreutils/libcoreutils/built-in.o debianutils/built-in.o
e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o
init/built-in.o libbb/built-in.o libpwdgrp/built-in.o
loginutils/built-in.o mailutils/built-in.o miscutils/built-in.o
modutils/built-in.o networking/built-in.o
networking/libiproute/built-in.o networking/udhcp/built-in.o
printutils/built-in.o procps/built-in.o runit/built-in.o
selinux/built-in.o shell/built-in.o sysklogd/built-in.o
util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group
-Wl,--start-group -lcrypt -lm -Wl,--end-group ==========
applets/built-in.o: In function `_start': (.text+0x0): multiple
definition of `_start' /opt/musl/lib/crt1.o:(.text+0x0): first defined
here collect2: ld returned 1 exit status make: *** [busybox_unstripped]
Error 1
=======END of error
grep + strings tell me that "_start" is found in crt1.o, and in the
"start.o" section of libc.a (and libc.so). 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: musl-gcc vs. BusyBox 1.18.5: multiple definitions of '_start'
  2011-07-14 20:24 musl-gcc vs. BusyBox 1.18.5: multiple definitions of '_start' Isaac Dunham
@ 2011-07-14 20:28 ` Rich Felker
  2011-07-15 10:01 ` Christian Neukirchen
  1 sibling, 0 replies; 4+ messages in thread
From: Rich Felker @ 2011-07-14 20:28 UTC (permalink / raw)
  To: musl

On Thu, Jul 14, 2011 at 01:24:37PM -0700, Isaac Dunham wrote:
> I'm trying to set up a musl-based busybox system, using a version of
> musl (d3fd192523db544e6005051f224a2d7bafabedd9) that I pulled from git
> just an hour or so ago (prefix=/opt/musl).
> My host is Ubuntu 10.04 "Lucid Lynx" with gcc 4.4.3.
> When I build busybox 1.18.5 with the default cc (gcc using eglibc), it
> compiles appropriately.  But when I use "CC=musl-gcc", compilation fails
> at the link step (I did a little patching to get that far, BTW):  
> AR util-linux/volume_id/lib.a 
> LINK    busybox_unstripped
> Trying libraries: crypt m
> Failed: -Wl,--start-group -lcrypt -lm -Wl,--end-group
> Output of:
> musl-gcc -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes
> -Wunused -Wunused-parameter -Wunused-function -Wunused-value
> -Wmissing-prototypes -Wmissing-declarations
> -Wdeclaration-after-statement -Wold-style-definition
> -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer
> -ffunction-sections -fdata-sections -fno-guess-branch-probability
> -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1
> -falign-labels=1 -falign-loops=1 -Os -march=i386
> -mpreferred-stack-boundary=2 -static -o busybox_unstripped
> -Wl,--sort-common -Wl,--sort-section,alignment -Wl,--gc-sections
> -Wl,--start-group applets/built-in.o archival/lib.a
> archival/libarchive/lib.a console-tools/lib.a coreutils/lib.a
> coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a
> editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a
> loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a
> networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a
> printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shell/lib.a
> sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a
> archival/built-in.o archival/libarchive/built-in.o
> console-tools/built-in.o coreutils/built-in.o
> coreutils/libcoreutils/built-in.o debianutils/built-in.o
> e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o
> init/built-in.o libbb/built-in.o libpwdgrp/built-in.o
> loginutils/built-in.o mailutils/built-in.o miscutils/built-in.o
> modutils/built-in.o networking/built-in.o
> networking/libiproute/built-in.o networking/udhcp/built-in.o
> printutils/built-in.o procps/built-in.o runit/built-in.o
> selinux/built-in.o shell/built-in.o sysklogd/built-in.o
> util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group
> -Wl,--start-group -lcrypt -lm -Wl,--end-group ==========
> applets/built-in.o: In function `_start': (.text+0x0): multiple
> definition of `_start' /opt/musl/lib/crt1.o:(.text+0x0): first defined
> here collect2: ld returned 1 exit status make: *** [busybox_unstripped]
> Error 1
> =======END of error
> grep + strings tell me that "_start" is found in crt1.o, and in the
> "start.o" section of libc.a (and libc.so). 

It looks like the built-in.o files have been compiled/linked
incorrectly, probably due to the linker wrapper in the musl-gcc script
not being able to detect that busybox is trying to link multiple .o
files to make a new .o file rather than an executable file.
Unfortunately the kbuild system busybox uses is really obfuscated and
it's hard for me to tell quite what's going on or how to work around
it...

Ideas anyone?

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: musl-gcc vs. BusyBox 1.18.5: multiple definitions of '_start'
  2011-07-14 20:24 musl-gcc vs. BusyBox 1.18.5: multiple definitions of '_start' Isaac Dunham
  2011-07-14 20:28 ` Rich Felker
@ 2011-07-15 10:01 ` Christian Neukirchen
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Neukirchen @ 2011-07-15 10:01 UTC (permalink / raw)
  To: musl

Isaac Dunham <idunham@lavabit.com> writes:

> applets/built-in.o: In function `_start': (.text+0x0): multiple
> definition of `_start' /opt/musl/lib/crt1.o:(.text+0x0): first defined
> here collect2: ld returned 1 exit status make: *** [busybox_unstripped]
> Error 1
> =======END of error
> grep + strings tell me that "_start" is found in crt1.o, and in the
> "start.o" section of libc.a (and libc.so). 

Sabotage uses:

make CFLAGS_busybox="-Wl,-z,muldefs" HOSTCC=gcc CC=$R/bin/musl-gcc

and that works, but not sure which _start is used there.
(It's not required on a pure-musl system anymore.)

-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: musl-gcc vs. BusyBox 1.18.5: multiple definitions of '_start'
@ 2011-07-16  4:14 Isaac Dunham
  0 siblings, 0 replies; 4+ messages in thread
From: Isaac Dunham @ 2011-07-16  4:14 UTC (permalink / raw)
  To: musl

Thanks for the information; that fixes it.
Now to continue with bootstrap...



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-16  4:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-14 20:24 musl-gcc vs. BusyBox 1.18.5: multiple definitions of '_start' Isaac Dunham
2011-07-14 20:28 ` Rich Felker
2011-07-15 10:01 ` Christian Neukirchen
2011-07-16  4:14 Isaac Dunham

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).