aboutsummaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-05-07 17:46:57 +0930
committerAlan Modra <amodra@gmail.com>2023-05-08 10:11:47 +0930
commitdefb881754df013e337eb981bc54b5e83fd01fa4 (patch)
tree49a8f61112fb19427b2a69e9b0ce3764f63c96cd /ld/pe-dll.c
parent8406216e94ee15c0b2267a7f1b229a00d6dc772d (diff)
downloadbinutils-defb881754df013e337eb981bc54b5e83fd01fa4.zip
binutils-defb881754df013e337eb981bc54b5e83fd01fa4.tar.gz
binutils-defb881754df013e337eb981bc54b5e83fd01fa4.tar.bz2
PR30343, LTO ignores linker reference to _pei386_runtime_relocator
Make a reference to _pei386_runtime_relocator before LTO recompilation. This is done regardless of whether such a reference will be used, because it can't be known whether it is needed before LTO. I also found it necessary to enable long section names for the bfd created in make_runtime_pseudo_reloc, because otherwise when writing it out to the bfd-in-memory we get the section written as .rdata_r which when read back in leads to a linker warning ".rdata_r: section below image base" and likely runtime misbehaviour. PR 30343 * emultempl/pe.em (make_runtime_ref): New function. (gld${EMULATION_NAME}_before_plugin_all_symbols_read): New function. (LDEMUL_BEFORE_PLUGIN_ALL_SYMBOLS_READ): Define. * emultempl/pep.em: Similarly to pe.em. * pe-dll.c (make_runtime_pseudo_reloc): Set long section names.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index ab13e3b..8d74dba 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -2720,6 +2720,7 @@ make_runtime_pseudo_reloc (const char *name ATTRIBUTE_UNUSED,
rt_rel
= quick_section (abfd, ".rdata_runtime_pseudo_reloc", SEC_HAS_CONTENTS, 2);
+ bfd_coff_set_long_section_names (abfd, true);
quick_symbol (abfd, "", fixup_name, "", UNDSEC, BSF_GLOBAL, 0);