aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-x86-64/pr32591-1c.t
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2025-01-30 08:48:45 +0800
committerH.J. Lu <hjl.tools@gmail.com>2025-02-07 06:02:05 +0800
commit73ab3b9825d232f0f3a4ad811e88697f9b9ab162 (patch)
tree959ef0f7ba4adc984652da2ddc6f49bab1c24992 /ld/testsuite/ld-x86-64/pr32591-1c.t
parent9a7ed136a9b405408ab20e01f2cab415e7a39b5b (diff)
downloadgdb-73ab3b9825d232f0f3a4ad811e88697f9b9ab162.zip
gdb-73ab3b9825d232f0f3a4ad811e88697f9b9ab162.tar.gz
gdb-73ab3b9825d232f0f3a4ad811e88697f9b9ab162.tar.bz2
x86-64: Estimate output section layout before sizing dynamic sections
When sizing dynamic sections, elf_x86_64_scan_relocs converts GOTPCREL relocations to R_X86_64_PC32, R_X86_64_32S or R_X86_64_32 for local symbols. But at that time, since the output section layout is unknown, the local symbol values can't be determined. Later linker issues an error if the converted relocation overflows when resolving relocations against these local symbols. Update the x86-64 ELF linker to estimate output section layout before sizing dynamic sections and use the preliminary output section layout info to skip the GOTPCREL relocation conversion if the converted relocation overflows. bfd/ PR ld/32591 * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Add an input section argument. Use the lowest-addressed section to estimate the __ehdr_start symbol value. Don't convert relocation if the converted relocation will overflow. ld/ PR ld/32591 * emultempl/elf-x86.em (elf_x86_64_before_allocation): New. Defined for x86-64. (LDEMUL_BEFORE_ALLOCATION): Likewise. * testsuite/ld-x86-64/pr19609-2a.d: Don't fail. * testsuite/ld-x86-64/pr19609-2b.d: Likewise. * testsuite/ld-x86-64/pr19609-4a.d: Likewise. * testsuite/ld-x86-64/pr19609-5d.d: Likewise. * testsuite/ld-x86-64/pr19609-7a.d: Likewise. * testsuite/ld-x86-64/pr19609-7c.d: Likewise. * testsuite/ld-x86-64/pr32591-1.s: New file. * testsuite/ld-x86-64/pr32591-1a-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-1a.d: Likewise. * testsuite/ld-x86-64/pr32591-1a.t: Likewise. * testsuite/ld-x86-64/pr32591-1b-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-1b.d: Likewise. * testsuite/ld-x86-64/pr32591-1b.t: Likewise. * testsuite/ld-x86-64/pr32591-1c-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-1c.d: Likewise. * testsuite/ld-x86-64/pr32591-1c.t: Likewise. * testsuite/ld-x86-64/pr32591-1d-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-1d.d: Likewise. * testsuite/ld-x86-64/pr32591-1d.t: Likewise. * testsuite/ld-x86-64/pr32591-2.s: Likewise. * testsuite/ld-x86-64/pr32591-2-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-2.d: Likewise. * testsuite/ld-x86-64/pr32591-2.t: Likewise. * testsuite/ld-x86-64/pr32591-3.s: Likewise. * testsuite/ld-x86-64/pr32591-3-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-3.d: Likewise. * testsuite/ld-x86-64/pr32591-3.t: Likewise. * testsuite/ld-x86-64/pr32591-4.s: Likewise. * testsuite/ld-x86-64/pr32591-4-x32.d: Likewise. * testsuite/ld-x86-64/pr32591-4.d: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run PR ld/32591 tests. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'ld/testsuite/ld-x86-64/pr32591-1c.t')
-rw-r--r--ld/testsuite/ld-x86-64/pr32591-1c.t6
1 files changed, 6 insertions, 0 deletions
diff --git a/ld/testsuite/ld-x86-64/pr32591-1c.t b/ld/testsuite/ld-x86-64/pr32591-1c.t
new file mode 100644
index 0000000..3bfb7f2
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr32591-1c.t
@@ -0,0 +1,6 @@
+SECTIONS {
+ .text.foo 0x100000 : { *(.text.foo) }
+ .text 0x200000 : { *(.text) }
+ .got 0x300000 : { *(.got) }
+ data 0x400000 : { *(data) }
+}