Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 #57982.
- Loading branch information