* [binutils-gdb] or1k relocation truncated to fit: R_OR1K_GOT16 even when using -mcmodel=large
@ 2023-05-10 11:09 Nick Clifton
0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-05-10 11:09 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8b7b3b2bf4357781439e5434c4a5942ea29e983d
commit 8b7b3b2bf4357781439e5434c4a5942ea29e983d
Author: Luca Bonissi <gcc@scarsita.it>
Date: Wed May 10 12:08:28 2023 +0100
or1k relocation truncated to fit: R_OR1K_GOT16 even when using -mcmodel=large
PR 30422
* elf32-or1k.c (or1k_elf_relocate_section): Prescan for R_OR1K_GOT_AHI16 relocs as they may occur after R_OR1K_GOT16 relocs.
Diff:
---
bfd/ChangeLog | 7 +++++++
bfd/elf32-or1k.c | 14 +++++++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b8150d4d0c8..5cb20e1c278 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2023-05-10 Luca Bonissi <gcc@scarsita.it>
+
+ PR 30422
+ * elf32-or1k.c (or1k_elf_relocate_section): Prescan for
+ R_OR1K_GOT_AHI16 relocs as they may occur after R_OR1K_GOT16
+ relocs.
+
2023-05-05 Nick Clifton <nickc@redhat.com>
PR 30354
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 48b8f765747..6b20e27cf09 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -1341,6 +1341,17 @@ or1k_elf_relocate_section (bfd *output_bfd,
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
+ /* Make a full scan for R_OR1K_GOT_AHI16, since it could be AFTER R_OR1K_GOT16. */
+ for (rel = relocs; rel < relend; rel++)
+ {
+ int r_type = ELF32_R_TYPE (rel->r_info);
+ if (r_type==R_OR1K_GOT_AHI16)
+ {
+ saw_gotha = true;
+ break;
+ }
+ }
+
for (rel = relocs; rel < relend; rel++)
{
reloc_howto_type *howto;
@@ -1520,9 +1531,6 @@ or1k_elf_relocate_section (bfd *output_bfd,
|| r_type == R_OR1K_GOT_AHI16)
relocation -= got_sym_value;
- if (r_type == R_OR1K_GOT_AHI16)
- saw_gotha = true;
-
/* If we have a R_OR1K_GOT16 following a R_OR1K_GOT_AHI16
relocation we assume the code is doing the right thing to avoid
overflows. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-10 11:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-10 11:09 [binutils-gdb] or1k relocation truncated to fit: R_OR1K_GOT16 even when using -mcmodel=large Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).