[llvm-bugs] [Bug 36686] New: Recent COFF dso_local changes break Firefox ThinLTO build
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Mar 11 07:02:27 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=36686
Bug ID: 36686
Summary: Recent COFF dso_local changes break Firefox ThinLTO
build
Product: new-bugs
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: dmajor at mozilla.com
CC: llvm-bugs at lists.llvm.org, rafael at espindo.la
Consider a library with a header that looks like this:
```
// MyLibrary.h
#ifdef BUILDING_MY_LIBRARY
#define MYAPI __declspec(dllexport)
#else
#define MYAPI __declspec(dllimport)
#endif
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
continue.
------------------- 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180311/8b65efcf/attachment.html>
More information about the llvm-bugs
mailing list