Fix: strip --strip-debug breaks relocations

PR 31106
  * elfcode.h (elf_write_relocs): Do not convert a relocation against a zero-value absolute symbol into a relocation without a symbol if the symbol is being used for a complex relocation.
This commit is contained in:
Nick Clifton
2023-12-05 15:18:40 +00:00
parent 3381781151
commit e60675a228
2 changed files with 14 additions and 1 deletions
+7
View File
@@ -1,3 +1,10 @@
2023-12-05 Nick Clifton <nickc@redhat.com>
PR 31106
* elfcode.h (elf_write_relocs): Do not convert a relocation
against a zero-value absolute symbol into a relocation without a
symbol if the symbol is being used for a complex relocation.
2023-11-21 Nick Clifton <nickc@redhat.com>
PR 31067
+7 -1
View File
@@ -1014,7 +1014,13 @@ elf_write_relocs (bfd *abfd, asection *sec, void *data)
sym = *ptr->sym_ptr_ptr;
if (sym == last_sym)
n = last_sym_idx;
else if (bfd_is_abs_section (sym->section) && sym->value == 0)
/* If the relocation is against an absolute symbol whoes value is
zero, then the symbol can be dropped, simplifying the reloc.
PR 31106: Except for complex relocations where the symbols
itself might be significant. */
else if (bfd_is_abs_section (sym->section)
&& sym->value == 0
&& (sym->flags & BSF_RELC) == 0)
n = STN_UNDEF;
else
{