[Top][All Lists]

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

[Bug gold/12880] gold doesn't generate PT_INTERP for .interp section

From: roland at gnu dot org
Subject: [Bug gold/12880] gold doesn't generate PT_INTERP for .interp section
Date: Sat, 18 Jun 2011 04:42:55 +0000


Roland McGrath <roland at gnu dot org> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #3 from Roland McGrath <roland at gnu dot org> 2011-06-18 04:42:35 
UTC ---
> This is not precisely how GNU ld behaves, as GNU ld behaves oddly when you 
> both
> use a --dynamic-linker option and you have a .interp section.  It appears to
> keep the contents of the .interp section but to set the length to that of the
> --dynamic-linker option.

The behavior I see from GNU ld is that it inserts a leading .interp input
section for the -dynamic-linker value, joins this with the user-supplied
explicit .interp section into a single .interp output section in the usual way,
and then makes PT_INTERP exactly match the address and size of the .interp
output section.

That is not especially helpful behavior, but it is entirely understandable.

With today's tree gold's behavior in fact is to create a leading section called
"interp" (no dot) containing the -dynamic-linker value.  It places this at the
start of text as expected and uses it for PT_INTERP.  The user-supplied
".interp" section appears later (after .rodata, an appropriate generic
placement for that section's characteristics).  When I instead define an
"interp" section, then I get the same two sections with the same placement, but
both called "interp".  (With the typo fix on gold/layout.cc:3884, I still get
two separately-placed sections when they're called ".interp".)

Bugs aside, IMHO the most desireable behavior would be to honor just the user's
.interp section and not generate any other (i.e. ignore -dynamic-linker when a
.interp is present).  Both the GNU ld and the gold results for the case when
both are defined are quite surprising results to see in the output file. 
(They're not surprising to me, I'm the kind of person who files this kind of
bug report.  But I think they would look highly suspicious to the average
programmer looking at ELF headers.)

The -dynamic-linker switch is given by the compiler driver and conceivably
someone could be using a .interp section in circumstances where -dynamic-linker
would be passed (i.e. not -shared and not -static).  It's easier to define that
section than to deduce and modify the linker arguments the compiler driver
runs.  But it hardly matters that it have any well-defined behavior in the case
where -dynamic-linker is also specified, unless GNU ld also gets fixed to match
that behavior, whatever it is.

Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

reply via email to

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