bindexplib: supporting llvm bitcode formats using llvm-nm

This commit is contained in:
Zsolt Parragi
2019-08-13 14:29:48 +02:00
committed by Brad King
parent 079b8e2916
commit c856d4556b
11 changed files with 144 additions and 12 deletions
@@ -13,8 +13,18 @@ elseif(CMake_TEST_IPO_WORKS_C)
endif()
add_library(foo foo.c)
if(NOT CYGWIN AND (NOT WIN32 OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang"))
add_library(bar SHARED bar.c)
if(WIN32)
# Bindexplib for clang supports LTO objects
set_target_properties(bar PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
else()
# TODO: bindexplib doesn't support exporting IPO symbols with other compilers on Windows
add_library(bar STATIC bar.c)
endif()
add_executable(CheckIPOSupported-C main.c)
target_link_libraries(CheckIPOSupported-C PUBLIC foo)
target_link_libraries(CheckIPOSupported-C PUBLIC foo bar)
enable_testing()
add_test(NAME CheckIPOSupported-C COMMAND CheckIPOSupported-C)
+4
View File
@@ -0,0 +1,4 @@
int bar()
{
return 0x42;
}
+2 -1
View File
@@ -1,8 +1,9 @@
int foo();
int bar();
int main()
{
if (foo() == 0) {
if (foo() != bar()) {
return 1;
}
return 0;
@@ -12,9 +12,20 @@ elseif(CMake_TEST_IPO_WORKS_CXX)
message(FATAL_ERROR "IPO expected to work, but the check failed:\n ${ipo_output}")
endif()
add_library(foo foo.cpp)
add_library(foo STATIC foo.cpp)
if(NOT CYGWIN AND (NOT WIN32 OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
add_library(bar SHARED bar.cpp)
if(WIN32)
# Bindexplib for clang supports LTO objects
set_target_properties(bar PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
else()
# TODO: bindexplib doesn't support exporting IPO symbols with other compilers on Windows
add_library(bar STATIC bar.cpp)
endif()
add_executable(CheckIPOSupported-CXX main.cpp)
target_link_libraries(CheckIPOSupported-CXX PUBLIC foo)
target_link_libraries(CheckIPOSupported-CXX PUBLIC foo bar)
enable_testing()
add_test(NAME CheckIPOSupported-CXX COMMAND CheckIPOSupported-CXX)
@@ -0,0 +1,4 @@
int bar()
{
return 0x42;
}
+2 -1
View File
@@ -1,8 +1,9 @@
int foo();
int bar();
int main()
{
if (foo() == 0) {
if (foo() != bar()) {
return 1;
}
return 0;