0001-i386-Allow-GOT32-relocations-against-ABS-symbols.patch 1.5 KB

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