[llvm] r341580 - Quick fix for -DBUILD_SHARED_LIBS=on build after rL341502

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 6 12:51:20 PDT 2018


Author: maskray
Date: Thu Sep  6 12:51:20 2018
New Revision: 341580

URL: http://llvm.org/viewvc/llvm-project?rev=341580&view=rev
Log:
Quick fix for -DBUILD_SHARED_LIBS=on build after rL341502

libLLVMTestingSupport.so references a symbol in utils/unittest/UnitTestMain/TestMain.cpp (a layering issue) and will cause a link error because of -Wl,-z,defs (cmake/modules/HandleLLVMOptions.cmake)

Waiting zturner for a better fix.

Modified:
    llvm/trunk/include/llvm/Testing/Support/SupportHelpers.h
    llvm/trunk/lib/Testing/Support/SupportHelpers.cpp
    llvm/trunk/unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp

Modified: llvm/trunk/include/llvm/Testing/Support/SupportHelpers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Testing/Support/SupportHelpers.h?rev=341580&r1=341579&r2=341580&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Testing/Support/SupportHelpers.h (original)
+++ llvm/trunk/include/llvm/Testing/Support/SupportHelpers.h Thu Sep  6 12:51:20 2018
@@ -56,7 +56,7 @@ void PrintTo(const ExpectedHolder<T> &It
 } // namespace detail
 
 namespace unittest {
-SmallString<128> getInputFileDirectory();
+SmallString<128> getInputFileDirectory(const char *Argv0);
 }
 } // namespace llvm
 

Modified: llvm/trunk/lib/Testing/Support/SupportHelpers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Testing/Support/SupportHelpers.cpp?rev=341580&r1=341579&r2=341580&view=diff
==============================================================================
--- llvm/trunk/lib/Testing/Support/SupportHelpers.cpp (original)
+++ llvm/trunk/lib/Testing/Support/SupportHelpers.cpp Thu Sep  6 12:51:20 2018
@@ -13,10 +13,8 @@
 using namespace llvm;
 using namespace llvm::unittest;
 
-extern const char *TestMainArgv0;
-
-SmallString<128> llvm::unittest::getInputFileDirectory() {
-  llvm::SmallString<128> Result = llvm::sys::path::parent_path(TestMainArgv0);
+SmallString<128> llvm::unittest::getInputFileDirectory(const char *Argv0) {
+  llvm::SmallString<128> Result = llvm::sys::path::parent_path(Argv0);
   llvm::sys::fs::make_absolute(Result);
   llvm::sys::path::append(Result, "llvm.srcdir.txt");
 

Modified: llvm/trunk/unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp?rev=341580&r1=341579&r2=341580&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp Thu Sep  6 12:51:20 2018
@@ -23,8 +23,10 @@
 using namespace llvm;
 using namespace llvm::pdb;
 
+extern const char *TestMainArgv0;
+
 TEST(NativeSymbolReuseTest, GlobalSymbolReuse) {
-  SmallString<128> InputsDir = unittest::getInputFileDirectory();
+  SmallString<128> InputsDir = unittest::getInputFileDirectory(TestMainArgv0);
   llvm::sys::path::append(InputsDir, "empty.pdb");
 
   std::unique_ptr<IPDBSession> S;
@@ -51,7 +53,7 @@ TEST(NativeSymbolReuseTest, GlobalSymbol
 }
 
 TEST(NativeSymbolReuseTest, CompilandSymbolReuse) {
-  SmallString<128> InputsDir = unittest::getInputFileDirectory();
+  SmallString<128> InputsDir = unittest::getInputFileDirectory(TestMainArgv0);
   llvm::sys::path::append(InputsDir, "empty.pdb");
 
   std::unique_ptr<IPDBSession> S;
@@ -93,7 +95,7 @@ TEST(NativeSymbolReuseTest, CompilandSym
 }
 
 TEST(NativeSymbolReuseTest, CompilandSymbolReuseBackwards) {
-  SmallString<128> InputsDir = unittest::getInputFileDirectory();
+  SmallString<128> InputsDir = unittest::getInputFileDirectory(TestMainArgv0);
   llvm::sys::path::append(InputsDir, "empty.pdb");
 
   std::unique_ptr<IPDBSession> S;




More information about the llvm-commits mailing list