diff options
author | Luca Bonissi <gcc@scarsita.it> | 2023-05-10 12:08:28 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2023-05-10 12:08:28 +0100 |
commit | 8b7b3b2bf4357781439e5434c4a5942ea29e983d (patch) | |
tree | 965a8206dd4999cc4376dfa2fad1d1f5337500ea | |
parent | 496917ce466c703c1ae3bf1cbbe753de1c091445 (diff) | |
download | binutils-8b7b3b2bf4357781439e5434c4a5942ea29e983d.zip binutils-8b7b3b2bf4357781439e5434c4a5942ea29e983d.tar.gz binutils-8b7b3b2bf4357781439e5434c4a5942ea29e983d.tar.bz2 |
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.
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elf32-or1k.c | 14 |
2 files changed, 18 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b8150d4..5cb20e1 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 48b8f76..6b20e27 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. */ |