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: The current linker failed to generate working Linux kernel


On Thu, Aug 17, 2006 at 09:44:53AM -0700, H. J. Lu wrote:
> On Thu, Aug 17, 2006 at 10:50:39AM +0930, Alan Modra wrote:
> > Not OK.  The main reason I added this code was to make using overlays
> > simpler.  See http://sourceware.org/ml/binutils/2006-07/msg00314.html
> > Your patch means that all loaded sections after an overlay would again
> > need to have their lma specified, which is a pain.
> 
> I don't see why I have to specify lma after overlay:

My goal is to be able to insert an OVERLAY stanza into one of the
existing linker scripts *without* having to mess around with dot as you
are doing in your testcases, and have ld generate a nicely packed
object file.  I would expect ld -N to not generate any extra segments
apart from those for the overlay sections, ie. at most one segment
before the overlays, one segment for each overlay section, and at most
one after the overlays, and for p_paddr of each segment to follow on
from the previous segment's ending p_paddr modulo alignment constraints.
This translates to minimum wasted ROM (or whatever the backing store is
for the overlays).  You'll find that if you try to do this with an old
linker, you'll need to specify lma for all sections following the
overlay.

eg. using your foo.s with this link script

SECTIONS
{
  OVERLAY :
  {
    .text1 {*(.text1)}
    .text2 {*(.text2)}
  }
  .text : { *(.text) }
  /DISCARD/ : { *(.*) }
}

results in

ld: section .text [0000000000000020 -> 000000000000004f] overlaps
section .text2 [0000000000000010 -> 000000000000002f]

-- 
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]