You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lld-link /OPT:REF drops a locally defined function reached only through an __imp_ slot (upstream LLVM) #1002
lld-link, with /OPT:REF, discards a function that is defined in the link and reached only through an __imp_ slot. LLD creates that slot when a declaration says __declspec(dllimport) and the definition is local. The slot then holds the image base, and the first call through it is an access violation. MSVC's link.exe keeps the function.
lld prints locally defined symbol imported: foo (defined in b.o) [LNK4217]. The output has an 8-byte .text (only jmp *slot), and its .rdata slot is 0x140000000, the image base. With /opt:noref, or without -ffunction-sections, the slot points at foo.
mcpp compiles test units with one section per function and links tests with section GC (2026.11.9.1). Release links collect sections too. A static library whose header declares dllimport by default crashes at its first call when a consumer does not define the library's static-API macro. The first such crash was mcpp pack --compress xz (mwrap.xz 5.8.3.1). The mcpp-index archive members crashed the same way on Windows, from mcpp 2026.11.9.1 on: 2026.11.8.1 passes, and 2026.11.9.1 fails with exit 133.
Workaround
A static library states its static-API macro for every TU that includes its headers. In the mcpp-index descriptors this is a staticlib feature that default implies, because a feature's defines reach consumers: compat.xz (LZMA_API_STATIC), compat.libarchive (LIBARCHIVE_STATIC), and the packages that already did so (compat.curl, compat.c-ares). The correct use of these headers requires the macro whichever linker is used. With it, the lld defect is not reached.
The upstream report on llvm/llvm-project is still to be filed.
Moved to the upstream defects register, #1027: UP-09.
The entry states what is measured, what mcpp does about it and when it is retired. This report stays as the full record and reproduction; a new measurement or a change of workaround goes to the entry's comment.
Activity
speak-agent commentedon Nov 26, 2026
Moved to the upstream defects register, #1027: UP-09.
The entry states what is measured, what mcpp does about it and when it is retired. This report stays as the full record and reproduction; a new measurement or a change of workaround goes to the entry's comment.