[PATCH] D33789: Export the required symbol from DynamicLibraryTests

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 05:50:28 PDT 2017


chill updated this revision to Diff 101548.

https://reviews.llvm.org/D33789

Files:
  unittests/Support/DynamicLibrary/CMakeLists.txt
  unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
  unittests/Support/DynamicLibrary/ExportedFuncs.cxx
  unittests/Support/DynamicLibrary/PipSqueak.cxx
  unittests/Support/DynamicLibrary/PipSqueak.h


Index: unittests/Support/DynamicLibrary/PipSqueak.h
===================================================================
--- unittests/Support/DynamicLibrary/PipSqueak.h
+++ unittests/Support/DynamicLibrary/PipSqueak.h
@@ -29,4 +29,6 @@
 #define PIPSQUEAK_EXPORT
 #endif
 
+extern "C" PIPSQUEAK_EXPORT const char *TestA();
+
 #endif
Index: unittests/Support/DynamicLibrary/PipSqueak.cxx
===================================================================
--- unittests/Support/DynamicLibrary/PipSqueak.cxx
+++ unittests/Support/DynamicLibrary/PipSqueak.cxx
@@ -45,4 +45,5 @@
   Glb.Vec = &V;
 }
 
-extern "C" PIPSQUEAK_EXPORT const char *TestA() { return "LibCall"; }
+#define PIPSQUEAK_TESTA_RETURN "LibCall"
+#include "ExportedFuncs.cxx"
Index: unittests/Support/DynamicLibrary/ExportedFuncs.cxx
===================================================================
--- /dev/null
+++ unittests/Support/DynamicLibrary/ExportedFuncs.cxx
@@ -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; }
Index: unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
===================================================================
--- unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
+++ unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
@@ -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";
Index: unittests/Support/DynamicLibrary/CMakeLists.txt
===================================================================
--- unittests/Support/DynamicLibrary/CMakeLists.txt
+++ unittests/Support/DynamicLibrary/CMakeLists.txt
@@ -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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33789.101548.patch
Type: text/x-patch
Size: 2743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170606/bffd900e/attachment.bin>


More information about the llvm-commits mailing list