This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR ld/3223: ld fails to link correct variables from linker script


On Sat, Sep 23, 2006 at 04:05:28PM -0700, H. J. Lu wrote:
> On Sat, Sep 23, 2006 at 09:56:27AM -0700, H. J. Lu wrote:
> > On Fri, Sep 22, 2006 at 06:09:29PM -0700, H. J. Lu wrote:
> > > When an empty output section is ignored, we also ignore its address. I
> > > think we should honor its address.
> > 
> > Here is the updated patch. I added ignored_vma so that we can set it
> > in one place.
> 
> It turns out that x86-64 linker scripts have

This is getting too complicated.  Can we take a step back and ask
ourselves exactly what we are trying to accomplish with empty section
removal?

I think it is quite reasonable to remove empty output sections, even
those used to define symbols via the linker script (the symbols
become absolute).  The case for ignoring linker script VMA and LMA
assignments isn't so strong, particularly since doing so can affect
following sections.  I think it would be safest if we went back to
always obeying them, even for ALIGN expressions.  Alternatively, we
could completely ignore the VMA and LMA assignments on empty output
sections.  I agree that the current situation, where we take note of
the VMA only within the section, is silly.

Given a linker script like the following

. = 0x123;
.data 0x1000 :
{
  __data_start = .;
  *(.data)
}
__data_end = .;

and assuming no input .data sections, obeying the VMA value would set
both __data_start and __data_end to 0x1000.  Ignoring the VMA would
set both __data_start and __data_end to 0x123.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]