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]

Provisional patch for issue 11997 (Different behaviour of MEMORY regions)


Hi Ian,

  I have attached a patch that I think addresses the problems raised by
  issue 11997 (the different behaviour of MEMORY regions in GOLD and GNU
  LD).  Would you mind reviewing it before I submit it to the issue
  please ?

  The patch is quite extensive, in the changes that it makes to the
  MEMORY handling code, as I found several other problems whilst working
  on getting compatibility between GOLD and GNU LD.

  I have also updated the linker documentation that describes how VMA
  and LMA addresses are computed, and extended the memory_test/rgn-at5
  test to take into account some problems that I found.

  There are still two discrepancies between GOLD's output and GNU LD's
  output:

    1)  GOLD creates a segment to hold the program headers, LD does
        not.

    2)  The ordering of the sections in the section header is
        different.  All the sections are present and correct, but LD
        orders them by name, whereas GOLD orders them by file offset.

  I am assuming that neither of these differences is important.  At
  least not for now.

  So, what do you think.  Is the patch OK for applying to GOLD ?

Cheers
  Nick

gold/ChangeLog
2010-10-04  Nick Clifton  <nickc@redhat.com>

	* script-sections.cc(class Memory_region): Remove
	current_lma_offset_ field.  Rename current_vma_offset_ to
        current_offset_.  Add last_section_ field.
        (Memory_region::get_current_vma_address): Rename to
	get_current_address.
        (Memory_region::get_current_lma_address): Delete.
        (Memory_region::increment_vma_offset): Rename to
	increment_offset.
        (Memory_region::increment_lma_offset): Delete.
        (Memory_region::attributes_compatible): New method.  Returns
	true if the provided section is compatible with the region.
        (Memory_region::get_last_section): New method.  Returns the last
	section to use the region.
        (Memory_region::set_last_section): New method.  Stores the last
        section to use the region.
        (Script_sections::block_in_region): New method.  Returns true if
	a block of memory is contained within a region.
        (Script_sections::find_memory_region): New method.  Locates a
	memory region to be used to set a VMA or LMA address.
        (Output_section_definition::set_section_addresses): Add code to
	check for addresses set by memory regions.
        (Output_segment::set_section_addresses): Remove memory region
	walking code.
        (Script_sections::create_segment): Add a warning if a header
	segment is created outside of any region.
	* script-sections.h (class Script_sections): Add prototypes for
	find_memory_region and block_in_region methods.
        
        * testsuite/memory_test.s: Use .long instead of .word.
        * testsuite/memory_test.t: Add some more output sections.
        * testsuite/memory_test.sh: Update expected output.

ld/ChangeLog
2010-10-04  Nick Clifton  <nickc@redhat.com>

	* ld.texinfo: Update description of computation of VMA and LMA
        addresses for output sections.
       
ld/testsuite/ChangeLog
2010-10-04  Nick Clifton  <nickc@redhat.com>

	* ld-scripts/rgn-at5.t: Add some more output sections.
        * ld-scripts/rgn-at5.d: Update expected output.

Attachment: gold.i11997.patch.bz2
Description: BZip2 compressed data


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