[Bug ld/30343] LTO ignores linker reference to _pei386_runtime_relocator
https://sourceware.org/bugzilla/show_bug.cgi?id=30343 Alan Modra changed: What|Removed |Added CC|amodra at gmail dot com| Assignee|unassigned at sourceware dot org |amodra at gmail dot com Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #7 from Alan Modra --- Minimal patch committed -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/30343] LTO ignores linker reference to _pei386_runtime_relocator
https://sourceware.org/bugzilla/show_bug.cgi?id=30343 --- Comment #6 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Alan Modra : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=defb881754df013e337eb981bc54b5e83fd01fa4 commit defb881754df013e337eb981bc54b5e83fd01fa4 Author: Alan Modra Date: Sun May 7 17:46:57 2023 +0930 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. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/30343] LTO ignores linker reference to _pei386_runtime_relocator
https://sourceware.org/bugzilla/show_bug.cgi?id=30343 --- Comment #5 from Pali Rohár --- Hello! I have test proposed fix and it works fine. Both LTO and non-LTO versions are correctly generated. Also everything is working fine when there is no psuedo reloc and _pei386_runtime_relocator() is not defined/compiled at all. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/30343] LTO ignores linker reference to _pei386_runtime_relocator
https://sourceware.org/bugzilla/show_bug.cgi?id=30343 --- Comment #4 from Alan Modra --- Created attachment 14864 --> https://sourceware.org/bugzilla/attachment.cgi?id=14864=edit possible fix -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/30343] LTO ignores linker reference to _pei386_runtime_relocator
https://sourceware.org/bugzilla/show_bug.cgi?id=30343 --- Comment #3 from Pali Rohár --- I have looked at the LD source code but I'm really not sure if I understood it correclty. But for me it looks like that when LD generates runtime pseudo reloc then it tries to reference _pei386_runtime_relocator symbol. All runtime pseudo relocs are handled during runtime by the code statically linked into PE binary called from the startup PE code. And this handling is implemened in mingw function named _pei386_runtime_relocator(). So I guess that this referencing in linker is trying to ensure that in final generated binary is code responsible for handling of runtime pseudo relocs created by LD linker itself. And if this my assumption is correct then this can be reason why compiling with LTO throws that error because LTO compiler can inline that function into startup code and explicit _pei386_runtime_relocator symbol is not used at all. But I'm really not sure this is just my guessing. Cannot be issue in ld/pe-dll.c function pe_create_runtime_relocator_reference() in the way how this symbol _pei386_runtime_relocator is referenced there? Should not it be added to "resolution info" (not sure what it is) like was described in the gcc bug? -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/30343] LTO ignores linker reference to _pei386_runtime_relocator
https://sourceware.org/bugzilla/show_bug.cgi?id=30343 Alan Modra changed: What|Removed |Added Assignee|amodra at gmail dot com|unassigned at sourceware dot org Summary|LTO drops explicitly|LTO ignores linker |referenced symbol |reference to |_pei386_runtime_relocator |_pei386_runtime_relocator CC||amodra at gmail dot com Status|ASSIGNED|NEW --- Comment #2 from Alan Modra --- I'm removing myself as assignee for this bug. I don't really know enough about details of the PE support code to take this one. -- You are receiving this mail because: You are on the CC list for the bug.