Since
commit
97da0e2677c4a38df2406576428ec27d1da26e7c
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>
/* The _DYNAMIC symbol. */
struct elf_link_hash_entry *hdynamic;
+ /* The __ehdr_start symbol. */
+ struct elf_link_hash_entry *hehdr_start;
+
/* A pointer to information used to merge SEC_MERGE sections. */
void *merge_info;
program headers, so provide a symbol __ehdr_start pointing there.
A program can use this to examine itself robustly. */
- struct elf_link_hash_entry *hash
- = elf_link_hash_lookup (elf_hash_table (link_info), "__ehdr_start",
- false, false, true);
+ struct elf_link_hash_table *htab = elf_hash_table (link_info);
+ struct elf_link_hash_entry *hash = htab->hehdr_start;
+
/* If the symbol was referenced and not defined, define it. */
if (hash != NULL
&& (hash->root.type == bfd_link_hash_new
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. */
h->def_regular = 1;
h->root.linker_def = 1;
h->root.rel_from_abs = 1;
+ elf_hash_table (&link_info)->hehdr_start = h;
}
}
}