Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 18 Jun 2019 17:58:43 -0400
From: Rich Felker <dalias@...c.org>
To: Reinoud Koornstra <reinoudkoornstra@...il.com>
Cc: musl@...ts.openwall.com
Subject: Re: where to find musl-gcc wrapper script

On Tue, Jun 18, 2019 at 02:49:17PM -0700, Reinoud Koornstra wrote:
> On Tue, Jun 18, 2019 at 2:37 PM Rich Felker <dalias@...c.org> wrote:
> >
> > On Tue, Jun 18, 2019 at 02:19:06PM -0700, Reinoud Koornstra wrote:
> > > I noticed that the -static gives me some weird stuff. If I use glibc
> > > to compile gdb and then rerun the compile command with static I do get
> > > to see it's a statically linked binary. It'll end up with warnings,
> > > but ...
> > > gdb compiles fine with musl as well. So after compiling i see:
> > > ELF 32-bit executable, ARM, EABI5 version 1 (SYSV). dynamically
> > > linked, interpreter /lib/ld-musl-armhf.so.1
> > > When I add -static to the arm-linux-musleabihf-g++ command it compiles
> > > seemingly fine as well.
> > > However when i run file again over this I see:
> > > ELF 32-bit executable, ARM, EABI5 version 1 (SYSV). dynamically
> > > linked, interpreter, /usr/lib/ld.so.1 ....
> > > So adding -static didn't seem to have the desired effect, it also all
> > > over sudden showed a different interpreter.
> > > Any ideas?
> >
> > What commands did you use to build musl-cross-make? Any config.mak
> > file? What options did you use when linking?
> 
> in the config.mak for musl-cross-make I used:
> TARGET = arm-linux-musleabihf
> OUTPUT = /home/libnl/MUSL-ARM32
> 
> The rest I left default.
> To configure gdb-8.3 i used:
> Then I added OUTPUT to my path: PATH=/home/libnl/MUSL-ARM32/bin:$PATH
> I configured gdb with:
> CC=arm-linux-musleabihf-gcc CXX=arm-linux-musleabihf-g++
> CFLAGS="-I/home/libnl/MUSL-ARM32/include"
> LDFLAGS="-L/home/libnl/MUSL-ARM32/lib" ./configure --enable-static
> --host=arm-linux-musleabihf --target=arm-linux-musleabihf
> --build=x86_64-ubuntu-linux
> 
> after this I used make.

Where is -static? I don't think gdb offers a way to build
static-linked; you need to hack it in by putting -static and --static
(both to trick libtool) in the LDFLAGS.

On top of that, and I think this is your actual problem, I'm pretty
sure there's a bug in gdb's build process that breaks static linking
by adding --export-dynamic or --dynamic-list to the link command line,
which ld then interprets as meaning it should behave like it's dynamic
linking. Arguably this is actually a bug in gcc that it lets bad
options get through to the linker when this happens, but the easiest
way to fix it is patching it out of gdb's makefile after running
configure. (Alternatively you could patch out the stuff in configure
that adds it.)

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.