elf: Store __ehdr_start hash in elf_link_hash_table

Since

commit 97da0e2677
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Jan 12 23:42:23 2022 +1030

    tweak __ehdr_start visibility and flags for check_relocs

creates __ehdr_start hash in lang_symbol_tweaks, store __ehdr_start hash
in elf_link_hash_table so that we just need to lookup it up only once.

bfd/

	* elf-bfd.h (elf_link_hash_table): Add hehdr_start.
	* elf.c (assign_file_positions_for_load_sections): Use
	hehdr_start.

ld/

	* ldelf.c (ldelf_before_allocation): Use hehdr_start for
	__ehdr_start hash.
	* ldlang.c (lang_symbol_tweaks): Store hehdr_start hash in
	hehdr_start.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
This commit is contained in:
H.J. Lu
2025-02-03 11:30:50 +08:00
parent 13bc088de0
commit bc61d5916a
4 changed files with 8 additions and 5 deletions

View File

@@ -1772,8 +1772,7 @@ ldelf_before_allocation (char **audit, char **depaudit,
if (!bfd_link_relocatable (&link_info))
{
struct elf_link_hash_table *htab = elf_hash_table (&link_info);
struct elf_link_hash_entry *h
= elf_link_hash_lookup (htab, "__ehdr_start", false, false, true);
struct elf_link_hash_entry *h = htab->hehdr_start;
/* Only adjust the export class if the symbol was referenced
and not defined, otherwise leave it alone. */