V3 [PATCH] ELF: Don't check relocations in non-loaded, non-alloced sections
Alan Modra
amodra@gmail.com
Thu Jun 4 07:47:49 GMT 2020
On Wed, Jun 03, 2020 at 11:55:08AM -0700, H.J. Lu wrote:
> --- a/bfd/elfxx-mips.c
> +++ b/bfd/elfxx-mips.c
> @@ -8618,7 +8618,6 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
> struct elf_link_hash_entry *h;
> bfd_boolean can_make_dynamic_p;
> bfd_boolean call_reloc_p;
> - bfd_boolean constrain_symbol_p;
>
> r_symndx = ELF_R_SYM (abfd, rel->r_info);
> r_type = ELF_R_TYPE (abfd, rel->r_info);
> @@ -8653,12 +8652,6 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
> and if pointer equality therefore doesn't matter. */
> call_reloc_p = FALSE;
>
> - /* Set CONSTRAIN_SYMBOL_P if we need to take the relocation
> - into account when deciding how to define the symbol.
> - Relocations in nonallocatable sections such as .pdr and
> - .debug* should have no effect. */
> - constrain_symbol_p = ((sec->flags & SEC_ALLOC) != 0);
> -
So "normal" sections will result in constrain_symbol_p being true.
> switch (r_type)
> {
> case R_MIPS_CALL16:
> @@ -8740,21 +8733,10 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
> case R_MIPS_NONE:
> case R_MIPS_JALR:
> case R_MICROMIPS_JALR:
> - /* These relocations have empty fields and are purely there to
> - provide link information. The symbol value doesn't matter. */
> - constrain_symbol_p = FALSE;
> - break;
> -
But in for some special relocs it should be false. I think removing
constrain_symbol_p is just wrong. You should keep it but initialise
to true.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list