]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
elfNN_c64_resize_section always sets alignment
authorMatthew Malcomson <matthew.malcomson@arm.com>
Mon, 21 Feb 2022 13:18:21 +0000 (13:18 +0000)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Mon, 21 Feb 2022 13:19:10 +0000 (13:19 +0000)
commitb3d71cf90a19ab159c7879b9e3bb7e8a3252dd9f
tree2ac266133a5b122a655ef6f33c64dc140ec3273a
parent2d3eb3ca3d53bf431c77437c12cc86def8078c8e
elfNN_c64_resize_section always sets alignment

Before this patch we would only change the alignment of a section if it
did not have a start and end address that was aligned properly.

This meant that there was nothing stopping the alignment of this section
degrading in the future.  On first glance this looks like it would not
be a problem since this function only adjusts sections in order of
increasing VMA (hence it would seem that the alignment of the current
section can not be reduced).

However, in some cases layout_sections_again can be seen to reduce the
alignment of sections if there was some initial space before the .text
section that it shrinks for some reason.  This led to a degredation of
the alignment of all sections after that point (until another highly
aligned section).

The testcase added for this change (in the final "testsuite" commit of
this patch series) is a good example of this, on first entry to the
elfNN_c64_resize_sections function .text happened to have a start
address of 0xb0 (which meant that .data.rel.ro was also aligned to such
a boundary and the function did not believe there was a need to align
.data.rel.ro to a 16 byte boundary).  However after the first call to
layout_sections_again this changed to 0x78, reducing the alignment of
.data.rel.ro in the process.
bfd/elfnn-aarch64.c
ld/testsuite/ld-aarch64/morello-sec-always-align.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/morello-sec-always-align.ld [new file with mode: 0644]
ld/testsuite/ld-aarch64/morello-sec-always-align.s [new file with mode: 0644]