kumquat-buildroot/package/binutils/2.37/0004-or1k-fix-pc-relative-relocation-against-dynamic-on-P.patch
Thomas Petazzoni 62f0232980 package/binutils: add version 2.37
State of the patches:

- 0001-sh-conf.patch
  Refreshed

- 0002-poison-system-directories.patch
  Refreshed, but needed some adaptations as the bfd_boolean type no
  longer exists, and the standard "bool" type is now used instead.

- 0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
  Drop, present in 2.37, merged upstream as
  a76ef689b60405e494cb99e198acf3c82f467f7d

- 0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
  Drop, present in 2.37, merged upstream as
  0b3e14c90283c5d234884d0ebe8510bc3c9bc687

- 0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
  Drop, present in 2.37, merged upstream as
  3c3de29b048bca6b4aa4235c647b9328e71801b6

- 0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
  Drop, present in 2.37, merged upstream as
  284a1309021a0ef4c29f198470d95652f02b13f0

- 0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
  Refreshed

- 0008-or1k-fix-pc-relative-relocation-against-dynamic-on-P.patch
  Refreshed

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-08-02 15:29:07 +02:00

60 lines
2.6 KiB
Diff

From 203b80f8dbdd3ddb860114b03351a0dea28c978f Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Sat, 10 Jul 2021 17:57:34 +0200
Subject: [PATCH] or1k: fix pc-relative relocation against dynamic on PC
relative 26 bit relocation
When building openal we were seeing the assert failure:
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourcePausev
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourceStopv
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourceRewindv
/home/buildroot/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: CMakeFiles/OpenAL.dir/al/source.cpp.o:
pc-relative relocation against dynamic symbol alSourcePlayv
collect2: error: ld returned 1 exit status
This happens because in R_OR1K_INSN_REL_26 case we can't reference local
symbol as previously done but we need to make sure that calls to actual
symbol always call the version of current object.
bfd/Changelog:
* elf32-or1k.c (or1k_elf_relocate_section): use a separate entry
in switch case R_OR1K_INSN_REL_26 where we need to check for
!SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 32063ab0289..67252394173 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -1543,6 +1543,18 @@ or1k_elf_relocate_section (bfd *output_bfd,
break;
case R_OR1K_INSN_REL_26:
+ /* For a non-shared link, these will reference plt or call the
+ version of actual object. */
+ if (bfd_link_pic (info) && !SYMBOL_CALLS_LOCAL (info, h))
+ {
+ _bfd_error_handler
+ (_("%pB: pc-relative relocation against dynamic symbol %s"),
+ input_bfd, name);
+ ret_val = FALSE;
+ bfd_set_error (bfd_error_bad_value);
+ }
+ break;
+
case R_OR1K_PCREL_PG21:
case R_OR1K_LO13:
case R_OR1K_SLO13:
--
2.31.1