[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PIE support

From: Ralf Wildenhues
Subject: Re: PIE support
Date: Thu, 1 Dec 2005 12:45:03 +0100
User-agent: Mutt/1.5.11

Hi Paul,

* Paul Jakma wrote on Thu, Dec 01, 2005 at 11:43:03AM CET:
> On Wed, 30 Nov 2005, Ralf Wildenhues wrote:
> >Because: when one day 100 compilers support this, they may use 10 
> >different #defines for this notion.  Or not, who knows.
> Sure. Then you should possibly also define __PIC__ for completeness / 
> symmetry? (relying on gcc to provide that at present right?)

I think not.  First of all, underscore'd symbols are forbidden country
for non-implementation-tools like libtool.  Second, don't ever use the
same symbol for two different meanings, one being, that GCC tells you
this is -fpic, the other being what libtool thinks about it.

> >Well, the more interesting question would probably be the GNU ld version
> >you used, and on what hardware.
> x86. GNU ld 2.9.1 and also 2.15. Thing is, I'm not sure gcc actually 
> used GNU ld. If I do:
> LD=gld gcc ....
> The binary works.
> If I manually compile to object code with gcc and then link by hand 
> with gld, it segfaults:
> $ gcc -c -fpie -pie -Os test.c -o test.o -lc -lnsl -lsocket
> $ gld -fpie  -lc -lnsl -lsocket -o test test.o
> It segfaults if I use Solaris ld by hand too, so I must be doing 
> something wrong.

Try 'gcc -v' in all cases to see what's happening.  Try 'gld --verbose'
and 'gcc -v -Wl,--verbose' to see what the linker thinks.

> In no case, where I let gcc handle linking, do I get anything that is 
> obviously a relocatable executable though. (variables in main are at 
> same location on each invocation).

Erm.  Stupid question: how can you recognize this way for certain,
whether this is PIE or not?  I only know of 'file a.out' reporting a
shared object.

> >I could not find such discussion (I searched before reporting the bug
> >upstream).  Could you point me to it?  Thanks.
> I can't I'm afraid. It came up when talking to the user who 
> desperately wanted an easier way to build our project's daemons as 
> PIE, I can't find the URL back though. :(

Bummer.  Thanks for searching, though.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]