[all-commits] [llvm/llvm-project] 3ab620: [LLD] [COFF] Handle manually defined __imp_ pointe...
Martin Storsjö via All-commits
all-commits at lists.llvm.org
Sat Nov 4 14:49:51 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3ab6209a3f93bdbeec8e9b9fcc00a9a4980915ff
https://github.com/llvm/llvm-project/commit/3ab6209a3f93bdbeec8e9b9fcc00a9a4980915ff
Author: Martin Storsjö <martin at martin.st>
Date: 2023-11-04 (Sat, 04 Nov 2023)
Changed paths:
M lld/COFF/InputFiles.cpp
A lld/test/COFF/lto-imp-prefix.ll
Log Message:
-----------
[LLD] [COFF] Handle manually defined __imp_ pointers in LTO (#70777)
Such pointers are often used by the core parts of mingw-w64, to locally
define a function that might have been referred to with dllimport.
(MSVC style linkers can automatically provide such pointers, if there
are undefined references to `__imp_<func>` left but a definition of
`<func>` is available - although this prints the warning LNK4217. GNU ld
doesn't do this, so in mingw-w64, such things are generally handled by
manually providing the relevant `__imp_` pointers.)
Make sure that a full LTO build, that does LTO of both the `__imp_`
pointer and the object file referencing it, successfully resolves such
symbols.
This solution admittedly probably reduces the effect of the LTO
compilation if there would happen to be `__imp_` prefixed symbols
included, in LTO objects, that aren't actually used. Such symbols are
mostly used in the base toolchain, not often in user code, and usually
only the relevant object files are linked in anyway.
This fixes https://github.com/llvm/llvm-project/issues/57982.
More information about the All-commits
mailing list