Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110714202839.GN16618@brightrain.aerifal.cx>
Date: Thu, 14 Jul 2011 16:28:39 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: musl-gcc vs. BusyBox 1.18.5: multiple definitions of
 '_start'

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

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.