https://sourceware.org/bugzilla/show_bug.cgi?id=32591
--- Comment #18 from Sourceware Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by H.J. Lu <h...@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=73ab3b9825d232f0f3a4ad811e88697f9b9ab162 commit 73ab3b9825d232f0f3a4ad811e88697f9b9ab162 Author: H.J. Lu <hjl.to...@gmail.com> Date: Thu Jan 30 08:48:45 2025 +0800 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.to...@gmail.com> -- You are receiving this mail because: You are on the CC list for the bug.