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]

[PATCH][gold] Fix the assignment of LMA for subsequent sections which do not have their own explicit address set.


Hi,

This patch handles the case when a section without an explicitly set
VMA follows a section which has different LMA and VMA. In this case,
the subsequent section is expected to have the same difference
between its VMA and LMA as the previous section has. See
https://sourceware.org/binutils/docs/ld/Output-Section-LMA.html#Output-Section-LMA.

Best regards,
Igor Kudrin

---
gold/ChangeLog

	* output.cc
	(Output_segment::set_section_addresses): Handle the physical
	address (paddr) separately from the virtual address (addr).
	Adjust call to Output_segment::set_section_list_addresses.
	(Output_segment::set_section_list_addresses): Add paddr
	argument. Use the load address and the current physical
	address to calculate offsets of sections.
	* output.h (Output_segment::set_section_list_addresses):
	Add paddr argument.
	* script-sections.cc
	(Sections_element_dot_assignment::set_section_addresses):
	Calculate load_address using the change of the dot_value.
	(Output_section_definition::set_section_addresses): Handle
	the case when neighter a VMA nor an LMA region is set for
	the section.
	* testsuite/Makefile.am (pr20280): New test.
	* testsuite/Makefile.in: Regenerate
	* testsuite/pr20280.s: New test source file.
	* testsuite/pr20280.sh: New test script.
	* testsuite/pr20280.t: New test linker script.

Attachment: gold-pr20280-LMA.patch.txt
Description: gold-pr20280-LMA.patch.txt


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