1From 30a954525f4e53a9cd50a1a8a6f201c7cf6595c7 Mon Sep 17 00:00:00 2001 2From: "H.J. Lu" <hjl.tools@gmail.com> 3Date: Mon, 7 Feb 2022 15:22:19 -0800 4Subject: [PATCH] i386: Allow GOT32 relocations against ABS symbols 5 6GOT32 relocations are allowed since absolute value + addend is stored in 7the GOT slot. 8 9Tested on glibc 2.35 build with GCC 11.2 and -Os. 10 11bfd/ 12 13 PR ld/28870 14 * elfxx-x86.c (_bfd_elf_x86_valid_reloc_p): Also allow GOT32 15 relocations. 16 17 18Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> 19 20diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c 21index 7ac2411fc80..d00dc45677b 100644 22--- a/bfd/elfxx-x86.c 23+++ b/bfd/elfxx-x86.c 24@@ -1942,9 +1942,9 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section, 25 irel = *rel; 26 27 /* Only allow relocations against absolute symbol, which can be 28- resolved as absolute value + addend. GOTPCREL relocations 29- are allowed since absolute value + addend is stored in the 30- GOT slot. */ 31+ resolved as absolute value + addend. GOTPCREL and GOT32 32+ relocations are allowed since absolute value + addend is 33+ stored in the GOT slot. */ 34 if (bed->target_id == X86_64_ELF_DATA) 35 { 36 r_type &= ~R_X86_64_converted_reloc_bit; 37@@ -1965,7 +1965,9 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section, 38 else 39 valid_p = (r_type == R_386_32 40 || r_type == R_386_16 41- || r_type == R_386_8); 42+ || r_type == R_386_8 43+ || r_type == R_386_GOT32 44+ || r_type == R_386_GOT32X); 45 46 if (valid_p) 47 *no_dynreloc_p = true; 48