]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
ld: Rewrite lang_size_relro_segment_1
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 14 Jan 2022 21:48:36 +0000 (13:48 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 26 Jan 2022 13:33:30 +0000 (05:33 -0800)
commit8b7c6a1fbab5b0efc6abb50cdb24aef3954ac018
treeaa7dc46a18c4ab6a123d2e03f93f3c5ee9cd448b
parent34fd27445a73f73a58534239895d5fa0c181afff
ld: Rewrite lang_size_relro_segment_1

1. Compute the desired PT_GNU_RELRO segment base and find the maximum
section alignment of sections starting from the PT_GNU_RELRO segment.
2. Find the first preceding load section.
3. Don't add the 1-page gap between the first preceding load section and
the relro segment if the maximum page size >= the maximum section
alignment.  Align the PT_GNU_RELRO segment first.  Subtract the maximum
page size if therer is still a 1-page gap.

PR ld/28743
PR ld/28819
* ldlang.c (lang_size_relro_segment_1): Rewrite.
* testsuite/ld-x86-64/pr28743-1.d: New file.
* testsuite/ld-x86-64/pr28743-1.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr28743-1.

(cherry picked from commit c804c6f98d342c3d46f73d7a7ec6229d5ab1c9f3)
ld/ldlang.c
ld/testsuite/ld-x86-64/pr28743-1.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr28743-1.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp