aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-01-12 23:42:23 +1030
committerAlan Modra <amodra@gmail.com>2022-01-18 11:18:45 +1030
commit97da0e2677c4a38df2406576428ec27d1da26e7c (patch)
tree3f7a0a7c2dbf856d95a0fb876ec3257f848d316d /bfd
parent1f95afb8894820f99682bd9379804f5d2a1e324e (diff)
downloadbinutils-97da0e2677c4a38df2406576428ec27d1da26e7c.zip
binutils-97da0e2677c4a38df2406576428ec27d1da26e7c.tar.gz
binutils-97da0e2677c4a38df2406576428ec27d1da26e7c.tar.bz2
tweak __ehdr_start visibility and flags for check_relocs
bfd/ * elf-bfd.h (UNDEFWEAK_NO_DYNAMIC_RELOC): Test linker_def. ld/ * ldelf.c (ldelf_before_allocation): Don't force __ehdr_start local and hidden here.. * ldlang.c (lang_symbol_tweaks): ..do so here instead and set def_regular and linker_def for check_relocs. New function extracted from lang_process.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elf-bfd.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 4a85255..138ef46 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -291,9 +291,12 @@ weakdef (struct elf_link_hash_entry *h)
_bfd_elf_symbol_refs_local_p (H, INFO, 1)
/* Whether an undefined weak symbol should resolve to its link-time
- value, even in PIC or PIE objects. */
+ value, even in PIC or PIE objects. The linker_def test is to
+ handle symbols like __ehdr_start that may be undefweak in early
+ stages of linking but are guaranteed to be defined later. */
#define UNDEFWEAK_NO_DYNAMIC_RELOC(INFO, H) \
((H)->root.type == bfd_link_hash_undefweak \
+ && !(H)->root.linker_def \
&& (ELF_ST_VISIBILITY ((H)->other) != STV_DEFAULT \
|| (INFO)->dynamic_undefined_weak == 0))