PowerPC64 check_relocs

Tidy the dynamic reloc handling code in check_relocs, removing
leftover comments and code from when check_relocs was called as each
object file was read in.

	* elf64-ppc.c (ppc64_elf_check_relocs): Tidy dynamic reloc
	handling code.
	(dec_dynrel_count): Do the same here.
This commit is contained in:
Alan Modra
2022-05-04 16:00:28 +09:30
parent 758ffab46b
commit c99d782d9c

View File

@ -5324,33 +5324,17 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (NO_OPD_RELOCS && is_opd) if (NO_OPD_RELOCS && is_opd)
break; break;
/* If we are creating a shared library, and this is a reloc /* Set up information for symbols that might need dynamic
against a global symbol, or a non PC relative reloc relocations. At this point in linking we have read all
against a local symbol, then we need to copy the reloc the input files and resolved most symbols, but have not
into the shared library. However, if we are linking with yet decided whether symbols are dynamic or finalized
-Bsymbolic, we do not need to copy a reloc against a symbol flags. In some cases we might be setting dynamic
global symbol which is defined in an object we are reloc info for symbols that do not end up needing such.
including in the link (i.e., DEF_REGULAR is set). At That's OK, adjust_dynamic_symbol and allocate_dynrelocs
this point we have not seen all the input files, so it is work together with this code. */
possible that DEF_REGULAR is not set now but will be set
later (it is never cleared). In case of a weak definition,
DEF_REGULAR may be cleared later by a strong definition in
a shared library. We account for that possibility below by
storing information in the dyn_relocs field of the hash
table entry. A similar situation occurs when creating
shared libraries and symbol visibility changes render the
symbol local.
If on the other hand, we are creating an executable, we
may need to keep relocations for symbols satisfied by a
dynamic library if we manage to avoid copy relocs for the
symbol. */
dodyn: dodyn:
if ((h != NULL if ((h != NULL
&& (h->root.type == bfd_link_hash_defweak && !SYMBOL_REFERENCES_LOCAL (info, h))
|| (!h->def_regular && !h->root.ldscript_def)))
|| (h != NULL
&& !SYMBOL_REFERENCES_LOCAL (info, h))
|| (bfd_link_pic (info) || (bfd_link_pic (info)
&& (h != NULL && (h != NULL
? !bfd_is_abs_symbol (&h->root) ? !bfd_is_abs_symbol (&h->root)
@ -7245,10 +7229,7 @@ dec_dynrel_count (const Elf_Internal_Rela *rel,
} }
if ((h != NULL if ((h != NULL
&& (h->root.type == bfd_link_hash_defweak && !SYMBOL_REFERENCES_LOCAL (info, h))
|| (!h->def_regular && !h->root.ldscript_def)))
|| (h != NULL
&& !SYMBOL_REFERENCES_LOCAL (info, h))
|| (bfd_link_pic (info) || (bfd_link_pic (info)
&& (h != NULL && (h != NULL
? !bfd_is_abs_symbol (&h->root) ? !bfd_is_abs_symbol (&h->root)