From 95dd7a25bab98a93bd58c47e0b6d6f91791bf987 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 6 Sep 2018 19:51:20 +0000 Subject: [PATCH] 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. llvm-svn: 341580 --- llvm/include/llvm/Testing/Support/SupportHelpers.h | 2 +- llvm/lib/Testing/Support/SupportHelpers.cpp | 6 ++---- llvm/unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp | 8 +++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/llvm/include/llvm/Testing/Support/SupportHelpers.h b/llvm/include/llvm/Testing/Support/SupportHelpers.h index 437e3c1..b1c9548 100644 --- a/llvm/include/llvm/Testing/Support/SupportHelpers.h +++ b/llvm/include/llvm/Testing/Support/SupportHelpers.h @@ -56,7 +56,7 @@ void PrintTo(const ExpectedHolder &Item, std::ostream *Out) { } // namespace detail namespace unittest { -SmallString<128> getInputFileDirectory(); +SmallString<128> getInputFileDirectory(const char *Argv0); } } // namespace llvm diff --git a/llvm/lib/Testing/Support/SupportHelpers.cpp b/llvm/lib/Testing/Support/SupportHelpers.cpp index c0f4f44..13ff07c 100644 --- a/llvm/lib/Testing/Support/SupportHelpers.cpp +++ b/llvm/lib/Testing/Support/SupportHelpers.cpp @@ -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"); diff --git a/llvm/unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp b/llvm/unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp index 8168927..15afea6 100644 --- a/llvm/unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp +++ b/llvm/unittests/DebugInfo/PDB/NativeSymbolReuseTest.cpp @@ -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 S; @@ -51,7 +53,7 @@ TEST(NativeSymbolReuseTest, GlobalSymbolReuse) { } TEST(NativeSymbolReuseTest, CompilandSymbolReuse) { - SmallString<128> InputsDir = unittest::getInputFileDirectory(); + SmallString<128> InputsDir = unittest::getInputFileDirectory(TestMainArgv0); llvm::sys::path::append(InputsDir, "empty.pdb"); std::unique_ptr S; @@ -93,7 +95,7 @@ TEST(NativeSymbolReuseTest, CompilandSymbolReuse) { } TEST(NativeSymbolReuseTest, CompilandSymbolReuseBackwards) { - SmallString<128> InputsDir = unittest::getInputFileDirectory(); + SmallString<128> InputsDir = unittest::getInputFileDirectory(TestMainArgv0); llvm::sys::path::append(InputsDir, "empty.pdb"); std::unique_ptr S; -- 2.7.4