[PATCH] bfd_section_from_shdr: Support SHT_RELR sections

Nick Clifton nickc@redhat.com
Wed Dec 8 14:04:14 GMT 2021


Hi Fangrui,

> If a.so contains an SHT_RELR section, objcopy a.so will fail with:
> 
>      a.so: unknown type [0x13] section `.relr.dyn'
> 
> This change allows objcopy to work.
> 
> bfd/
>      * elf.c (bfd_section_from_shdr): Support SHT_RELR.

Approved - please apply.

Cheers
   Nick

PS. I wonder if this particular code:

+	if (hdr->sh_type == SHT_REL)
+	  size = (bfd_size_type) bed->s->sizeof_rel;
+	else if (hdr->sh_type == SHT_RELA)
+	  size = (bfd_size_type) bed->s->sizeof_rela;
+	else
+	  size = (bfd_size_type) bed->s->arch_size / 8;

Should be extracted into its own function.  I imagine that
is going to be needed in other locations in the BFD library....





More information about the Binutils mailing list