This revision was automatically updated to reflect the committed changes. Closed by commit rC360207: [COFF] Use COFF stubs for extern_weak functions (authored by rnk, committed by ).
Changed prior to commit: https://reviews.llvm.org/D61615?vs=198359&id=198558#toc Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61615/new/ https://reviews.llvm.org/D61615 Files: lib/CodeGen/CodeGenModule.cpp test/CodeGen/dso-local-executable.c Index: test/CodeGen/dso-local-executable.c =================================================================== --- test/CodeGen/dso-local-executable.c +++ test/CodeGen/dso-local-executable.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix=COFF %s // COFF-DAG: @bar = external dso_local global i32 -// COFF-DAG: @weak_bar = extern_weak dso_local global i32 +// COFF-DAG: @weak_bar = extern_weak global i32 // COFF-DAG: declare dso_local void @foo() // COFF-DAG: @baz = dso_local global i32 42 // COFF-DAG: define dso_local i32* @zed() Index: lib/CodeGen/CodeGenModule.cpp =================================================================== --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -763,6 +763,13 @@ !GV->isThreadLocal()) return false; } + + // On COFF, don't mark 'extern_weak' symbols as DSO local. If these symbols + // remain unresolved in the link, they can be resolved to zero, which is + // outside the current DSO. + if (TT.isOSBinFormatCOFF() && GV->hasExternalWeakLinkage()) + return false; + // Every other GV is local on COFF. // Make an exception for windows OS in the triple: Some firmware builds use // *-win32-macho triples. This (accidentally?) produced windows relocations
Index: test/CodeGen/dso-local-executable.c =================================================================== --- test/CodeGen/dso-local-executable.c +++ test/CodeGen/dso-local-executable.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix=COFF %s // COFF-DAG: @bar = external dso_local global i32 -// COFF-DAG: @weak_bar = extern_weak dso_local global i32 +// COFF-DAG: @weak_bar = extern_weak global i32 // COFF-DAG: declare dso_local void @foo() // COFF-DAG: @baz = dso_local global i32 42 // COFF-DAG: define dso_local i32* @zed() Index: lib/CodeGen/CodeGenModule.cpp =================================================================== --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -763,6 +763,13 @@ !GV->isThreadLocal()) return false; } + + // On COFF, don't mark 'extern_weak' symbols as DSO local. If these symbols + // remain unresolved in the link, they can be resolved to zero, which is + // outside the current DSO. + if (TT.isOSBinFormatCOFF() && GV->hasExternalWeakLinkage()) + return false; + // Every other GV is local on COFF. // Make an exception for windows OS in the triple: Some firmware builds use // *-win32-macho triples. This (accidentally?) produced windows relocations
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits