|
|
ccd7a4 |
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.35/bfd/elf-bfd.h
|
|
|
ccd7a4 |
--- binutils.orig/bfd/elf-bfd.h 2021-06-23 15:00:33.913477324 +0100
|
|
|
ccd7a4 |
+++ binutils-2.35/bfd/elf-bfd.h 2021-06-23 15:03:42.300235019 +0100
|
|
|
ccd7a4 |
@@ -1748,6 +1748,11 @@ struct bfd_elf_section_data
|
|
|
ccd7a4 |
/* Link from a text section to its .eh_frame_entry section. */
|
|
|
ccd7a4 |
asection *eh_frame_entry;
|
|
|
ccd7a4 |
|
|
|
ccd7a4 |
+ /* TRUE if the section has secondary reloc sections associated with it.
|
|
|
ccd7a4 |
+ FIXME: In the future it might be better to change this into a list
|
|
|
ccd7a4 |
+ of secondary reloc sections, making lookup easier and faster. */
|
|
|
ccd7a4 |
+ bfd_boolean has_secondary_relocs;
|
|
|
ccd7a4 |
+
|
|
|
ccd7a4 |
/* A pointer used for various section optimizations. */
|
|
|
ccd7a4 |
void *sec_info;
|
|
|
ccd7a4 |
};
|
|
|
ccd7a4 |
diff -rup binutils.orig/bfd/elf.c binutils-2.35/bfd/elf.c
|
|
|
ccd7a4 |
--- binutils.orig/bfd/elf.c 2021-06-23 15:00:33.902477396 +0100
|
|
|
ccd7a4 |
+++ binutils-2.35/bfd/elf.c 2021-06-23 15:02:36.269672347 +0100
|
|
|
ccd7a4 |
@@ -12672,6 +12672,7 @@ _bfd_elf_copy_special_section_fields (co
|
|
|
ccd7a4 |
{
|
|
|
ccd7a4 |
asection * isec;
|
|
|
ccd7a4 |
asection * osec;
|
|
|
ccd7a4 |
+ struct bfd_elf_section_data * esd;
|
|
|
ccd7a4 |
|
|
|
ccd7a4 |
if (isection == NULL)
|
|
|
ccd7a4 |
return FALSE;
|
|
|
ccd7a4 |
@@ -12687,8 +12688,9 @@ _bfd_elf_copy_special_section_fields (co
|
|
|
ccd7a4 |
if (osec == NULL)
|
|
|
ccd7a4 |
return FALSE;
|
|
|
ccd7a4 |
|
|
|
ccd7a4 |
- BFD_ASSERT (elf_section_data (osec)->sec_info == NULL);
|
|
|
ccd7a4 |
- elf_section_data (osec)->sec_info = elf_section_data (isec)->sec_info;
|
|
|
ccd7a4 |
+ esd = elf_section_data (osec);
|
|
|
ccd7a4 |
+ BFD_ASSERT (esd->sec_info == NULL);
|
|
|
ccd7a4 |
+ esd->sec_info = elf_section_data (isec)->sec_info;
|
|
|
ccd7a4 |
osection->sh_type = SHT_RELA;
|
|
|
ccd7a4 |
osection->sh_link = elf_onesymtab (obfd);
|
|
|
ccd7a4 |
if (osection->sh_link == 0)
|
|
|
ccd7a4 |
@@ -12731,6 +12733,10 @@ _bfd_elf_copy_special_section_fields (co
|
|
|
ccd7a4 |
osection->sh_info =
|
|
|
ccd7a4 |
elf_section_data (isection->bfd_section->output_section)->this_idx;
|
|
|
ccd7a4 |
|
|
|
ccd7a4 |
+ esd = elf_section_data (isection->bfd_section->output_section);
|
|
|
ccd7a4 |
+ BFD_ASSERT (esd != NULL);
|
|
|
ccd7a4 |
+ osection->sh_info = esd->this_idx;
|
|
|
ccd7a4 |
+ esd->has_secondary_relocs = TRUE;
|
|
|
ccd7a4 |
#if DEBUG_SECONDARY_RELOCS
|
|
|
ccd7a4 |
fprintf (stderr, "update header of %s, sh_link = %u, sh_info = %u\n",
|
|
|
ccd7a4 |
osec->name, osection->sh_link, osection->sh_info);
|
|
|
ccd7a4 |
diff -rup binutils.orig/bfd/elfcode.h binutils-2.35/bfd/elfcode.h
|
|
|
ccd7a4 |
--- binutils.orig/bfd/elfcode.h 2021-06-23 15:00:33.910477344 +0100
|
|
|
ccd7a4 |
+++ binutils-2.35/bfd/elfcode.h 2021-06-23 15:04:32.506902070 +0100
|
|
|
ccd7a4 |
@@ -987,7 +987,8 @@ elf_write_relocs (bfd *abfd, asection *s
|
|
|
ccd7a4 |
(*swap_out) (abfd, &src_rela, dst_rela);
|
|
|
ccd7a4 |
}
|
|
|
ccd7a4 |
|
|
|
ccd7a4 |
- if (!bed->write_secondary_relocs (abfd, sec))
|
|
|
ccd7a4 |
+ if (elf_section_data (sec)->has_secondary_relocs
|
|
|
ccd7a4 |
+ && !bed->write_secondary_relocs (abfd, sec))
|
|
|
ccd7a4 |
{
|
|
|
ccd7a4 |
*failedp = TRUE;
|
|
|
ccd7a4 |
return;
|