Bug ID: 36686
           Summary: Recent COFF dso_local changes break Firefox ThinLTO
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs

Consider a library with a header that looks like this:

// MyLibrary.h
#define MYAPI __declspec(dllexport)
#define MYAPI __declspec(dllimport)
MYAPI MyFunc();

...and then in the same DLL where MyLibrary is implemented, there is also a
client of that library, which tries to dllimport MyFunc from its own DLL.

With link.exe we just get a warning LNK4049 and live with it. Same goes for
clang-cl with ThinLTO disabled, but when ThinLTO is enabled the build can't

------------------- Reproducer

$ cat a.cpp
__declspec(dllimport) int foo();
int main() { return foo(); }

$ cat b.cpp
__declspec(dllexport) int foo() { return 42; }

$ clang-cl -c -flto=thin a.cpp b.cpp
$ lld-link -nodefaultlib -entry:main a.obj b.obj

------------------- Before r325915/r325940:

lld-link: warning: lto.tmp: locally defined symbol imported: ?foo@@YAHXZ
(defined in lto.tmp)

------------------- After r325915/r325940:

GlobalValue with DLLImport Storage is dso_local!
i32 ()* @"\01?foo@@YAHXZ"
LLVM ERROR: Broken module found, compilation aborted!

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to