Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 29 Jan 2020 15:48:30 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Static linking is broken after creation of DT_TEXTREL
 segment

On Wed, Jan 29, 2020 at 08:38:10PM +0100, Markus Wichmann wrote:
> On Wed, Jan 29, 2020 at 08:19:46PM +0100, Markus Wichmann wrote:
> > On Wed, Jan 29, 2020 at 09:41:46PM +0300, Андрей Аладьев wrote:
> > > gcc main.c /usr/lib/libgmp.a -o main && ./main
> >
> > Ooh boy, why would you do this? When there's a perfectly good -lgmp just
> > waiting for you.
> >
> 
> To expand upon this: libgmp makes sure not to create TEXTRELs if
> compiling for PIC. The function in question uses the m4 macro LEA, which
> picks the correct code for either situation. Using libgmp.a explicitly
> here means you told the code it would be running statically compiled and
> then used it for dynamic compilation, anyway.

This is a bug in gmp -- static libraries can be used in (static or
dynamic linked) PIE executables, and therefore should be compatible
with being built as PIC.

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.