This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PIE and --(no-)export-dynamic
On Sun, Mar 21, 2010 at 12:11:45PM +1030, Alan Modra wrote:
> On Sat, Mar 20, 2010 at 02:32:59PM +0100, Peter Hjalmarsson wrote:
> > Should the -export-dynamic/--no-export-dynamic do any difference on a
> > PIE file?
> >
> > As an example lets take ld/testsuite/ld-elfvers/vers4.c.
> > compile it:
> >
> > $ gcc -o test1 -Wl,--no-export-dynamic vers4.c
> > $ gcc -o test2 -fPIE -pie -Wl,--no-export-dynamic vers4.c
> >
> > If you objdump -T the resulting files you will see that test2 still
> > exports foo@@VERS_2.0 along other things (like main).
> >
> > Is this a expected behaviour or is it a bug?
>
> I think you are reading too much into the name of the option.
> --no-export-dynamic doesn't say "don't export any dynamic symbols".
> It is merely there to turn off --export-dynamic. See the ld info
> doc.
I think Peter's got a point. Why should a PIE version of vers4 export
foo? Or, for that matter, main? No dynamic object references the
symbol; it's just wasting space.
MIPS used to have this same problem for dynamic applications; we
(Richard S., I think, but I don't remember) fixed it just a year or
two ago.
--
Daniel Jacobowitz
CodeSourcery