[GOLD][PATCH] Fix a sort order breakage of the zero-length script output sections.
Viktor Kutuzov
vkutuzov@accesssoftek.com
Fri Oct 8 21:20:00 GMT 2010
This patch fixes a breaking of order of the empty script output
sections.
The Script_sections::create_segments method uses Sort_output_sections to
sort the output script sections by address. If some output section has a
zero length the following section will get the same address and the
Sort_output_sections compare method can change the specified positions
for these sections in this case. The updated method collates the
positions for the sections with equal addresses to arrange them in right
order.
The test script is also added for this case.
I defined the NATIVE_OR_CROSS_LINKER testsuite condition for the tests,
which can be executed for the both native and cross linkers. Also this
condition is used to prevent executing of the tests for the linkers
compiled for the different target host. Probably it will be useful for
some other tests also.
I tested all these changes on 32-bit Linux as native, arm-eabi host and
arm-eabi/ppc-eabi/sparc-elf cross linker.
-Viktor.
* configure.ac: Add NATIVE_OR_CROSS_LINKER condition macro.
* configure: Regenerate.
* testsuite/Makefile.am: Wrap the cross linker tests and the common
tests into NATIVE_OR_CROSS_LINKER;
Add the script section order test.
* testsuite/Makefile.in: Regenerate.
* testsuite/script_test_10.sh: New test. Test script section
order.
* testsuite/script_test_10.t: Likewise.
* testsuite/script_test_10.s: Likewise.
* script-sections.h (Script_sections): Sections_elements as public;
Add a new member to save a list of the section elements.
(Sort_output_sections::ctor): Add new parameter to pass a list
of the section elements.
* script-sections.cc (Sort_output_sections::swap): New method.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-gold-script-section-order.patch
Type: text/x-patch
Size: 79906 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20101008/63ae6fb5/attachment.bin>
More information about the Binutils
mailing list