This revision was automatically updated to reflect the committed changes.
Closed by commit rC340941: [MinGW] Don't mark external variables as DSO
local (authored by mstorsjo, committed by ).
Repository:
rC Clang
https://reviews.llvm.org/D51382
Files:
lib/CodeGen/CodeGenModule.cpp
test/Cod
mstorsjo added inline comments.
Comment at: test/CodeGen/dso-local-executable.c:14
+// MINGW-DAG: @bar = external global i32
+// MINGW-DAG: @weak_bar = extern_weak global i32
+// MINGW-DAG: declare dso_local void @foo()
rnk wrote:
> I take it that was a side effe
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.
lgtm
Comment at: test/CodeGen/dso-local-executable.c:14
+// MINGW-DAG: @bar = external global i32
+// MINGW-DAG: @weak_bar = extern_weak global i32
+// MINGW-DAG: declare dso_local
mstorsjo updated this revision to Diff 163033.
mstorsjo added a comment.
Changed the condition to GV->isDeclarationForLinker(), updated tests
accordingly (weak_bar in CodeGen/dso-local-executable.c lost the dso_local
flag) and added more tests in CodeGenCXX/dso-local-executable.cpp as requested.
mstorsjo added inline comments.
Comment at: lib/CodeGen/CodeGenModule.cpp:737
+// potentially could come from another DLL as DSO local.
+if (GV->hasExternalLinkage() && GV->isDeclaration() &&
+isa(GV) && !GV->isThreadLocal())
rnk wrote:
> I think
rnk added inline comments.
Comment at: lib/CodeGen/CodeGenModule.cpp:737
+// potentially could come from another DLL as DSO local.
+if (GV->hasExternalLinkage() && GV->isDeclaration() &&
+isa(GV) && !GV->isThreadLocal())
I think this linkage and d
mstorsjo created this revision.
mstorsjo added reviewers: rnk, pcc.
Since MinGW supports automatically importing external variables from DLLs even
without the DLLImport attribute, we shouldn't mark them as DSO local unless we
actually know them to be local for sure.
Keep marking thread local va