SPMI: Export dynamic symbols in superpmi for unix builds (#85967)
authorJakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Tue, 9 May 2023 18:35:22 +0000 (20:35 +0200)
committerGitHub <noreply@github.com>
Tue, 9 May 2023 18:35:22 +0000 (20:35 +0200)
This is necessary for Instrumentor_GetInsCount to get a public symbol
that pin can find.

src/coreclr/tools/superpmi/superpmi/CMakeLists.txt

index d1942b7..fc229a1 100644 (file)
@@ -12,6 +12,15 @@ if(CLR_CMAKE_HOST_WIN32)
   set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
 endif(CLR_CMAKE_HOST_WIN32)
 
+if(CLR_CMAKE_HOST_UNIX)
+    # Make sure a public symbol is created for Instrumentor_GetInsCount
+    if(CLR_CMAKE_HOST_APPLE)
+        add_linker_flag(-Wl,-export_dynamic)
+    else()
+        add_linker_flag(-Wl,--export-dynamic)
+    endif(CLR_CMAKE_HOST_APPLE)
+endif(CLR_CMAKE_HOST_UNIX)
+
 include_directories(.)
 include_directories(../superpmi-shared)