[llvm] r305181 - Export the required symbol from DynamicLibraryTests
Roger Ferrer Ibanez via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 12 00:22:15 PDT 2017
Author: rogfer01
Date: Mon Jun 12 02:22:15 2017
New Revision: 305181
URL: http://llvm.org/viewvc/llvm-project?rev=305181&view=rev
Log:
Export the required symbol from DynamicLibraryTests
Running unittests/Support/DynamicLibrary/DynamicLibraryTests fails
when LLVM is configured with -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON, because
the test's version script only contains symbols extracted from the static libraries,
that the test links with, but not those from the main object/executable itself.
The patch moves the one symbol, needed by the test, to a static library.
Fixes https://bugs.llvm.org/show_bug.cgi?id=32893
Patch by Momchil Velikov.
Differential Revision: https://reviews.llvm.org/D33789
Added:
llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx
Modified:
llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt
llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx
llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.h
Modified: llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt?rev=305181&r1=305180&r2=305181&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt (original)
+++ llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt Mon Jun 12 02:22:15 2017
@@ -1,7 +1,9 @@
set(LLVM_LINK_COMPONENTS Support)
-add_llvm_unittest(DynamicLibraryTests DynamicLibraryTest.cpp)
+add_library(DynamicLibraryLib STATIC ExportedFuncs.cxx)
+add_llvm_unittest(DynamicLibraryTests DynamicLibraryTest.cpp)
+target_link_libraries(DynamicLibraryTests DynamicLibraryLib)
export_executable_symbols(DynamicLibraryTests)
function(dynlib_add_module NAME)
Modified: llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp?rev=305181&r1=305180&r2=305181&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp (original)
+++ llvm/trunk/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp Mon Jun 12 02:22:15 2017
@@ -19,8 +19,6 @@
using namespace llvm;
using namespace llvm::sys;
-extern "C" PIPSQUEAK_EXPORT const char *TestA() { return "ProcessCall"; }
-
std::string LibPath(const std::string Name = "PipSqueak") {
const std::vector<testing::internal::string>& Argvs = testing::internal::GetArgvs();
const char *Argv0 = Argvs.size() > 0 ? Argvs[0].c_str() : "DynamicLibraryTests";
Added: llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx?rev=305181&view=auto
==============================================================================
--- llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx (added)
+++ llvm/trunk/unittests/Support/DynamicLibrary/ExportedFuncs.cxx Mon Jun 12 02:22:15 2017
@@ -0,0 +1,16 @@
+//===- llvm/unittest/Support/DynamicLibrary/DynamicLibraryLib.cpp ---------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PipSqueak.h"
+
+#ifndef PIPSQUEAK_TESTA_RETURN
+#define PIPSQUEAK_TESTA_RETURN "ProcessCall"
+#endif
+
+extern "C" PIPSQUEAK_EXPORT const char *TestA() { return PIPSQUEAK_TESTA_RETURN; }
Modified: llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx?rev=305181&r1=305180&r2=305181&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx (original)
+++ llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.cxx Mon Jun 12 02:22:15 2017
@@ -45,4 +45,5 @@ extern "C" PIPSQUEAK_EXPORT void TestOrd
Glb.Vec = &V;
}
-extern "C" PIPSQUEAK_EXPORT const char *TestA() { return "LibCall"; }
+#define PIPSQUEAK_TESTA_RETURN "LibCall"
+#include "ExportedFuncs.cxx"
Modified: llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.h?rev=305181&r1=305180&r2=305181&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.h (original)
+++ llvm/trunk/unittests/Support/DynamicLibrary/PipSqueak.h Mon Jun 12 02:22:15 2017
@@ -29,4 +29,6 @@
#define PIPSQUEAK_EXPORT
#endif
+extern "C" PIPSQUEAK_EXPORT const char *TestA();
+
#endif
More information about the llvm-commits
mailing list