Add more CMake sugar for NetBSD
authorKamil Rytarowski <n54@gmx.com>
Sun, 14 Feb 2016 03:31:57 +0000 (04:31 +0100)
committerKamil Rytarowski <n54@gmx.com>
Sun, 14 Feb 2016 03:45:41 +0000 (04:45 +0100)
This resolves 'gen-dactable-rva.sh does not print to dactablerva.h' dotnet/coreclr#3168

This fixes issue with g_dacTable unavailable in libcoreclr.so.

This patch assumes GNU ld(1) on NetBSD

Thanks to Bruce Mitchener @waywardmonkeys for pointing out ld(1) nits.

Commit migrated from https://github.com/dotnet/coreclr/commit/4e548e16efb02b6c97c10eb9fd3d49ac94245507

src/coreclr/src/dlls/dbgshim/CMakeLists.txt
src/coreclr/src/dlls/mscordac/CMakeLists.txt
src/coreclr/src/dlls/mscordbi/CMakeLists.txt
src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt
src/coreclr/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt

index 491a0e1..621ab13 100644 (file)
@@ -24,11 +24,11 @@ if(CLR_CMAKE_PLATFORM_UNIX)
     add_compile_options(-fPIC)
 endif(CLR_CMAKE_PLATFORM_UNIX)
 
-if(CLR_CMAKE_PLATFORM_LINUX)
+if(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_NETBSD)
     # This option is necessary to ensure that the overloaded delete operator defined inside
     # of the utilcode will be used instead of the standard library delete operator.
     set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic -Bsymbolic-functions")
-endif(CLR_CMAKE_PLATFORM_LINUX)
+endif(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_NETBSD)
 
 add_library_clr(dbgshim SHARED ${DBGSHIM_SOURCES})
 
index 9066b05..4070440 100644 (file)
@@ -30,7 +30,7 @@ if(WIN32)
     set(START_LIBRARY_GROUP)
     set(END_LIBRARY_GROUP)
 else(WIN32)
-    if(CLR_CMAKE_PLATFORM_LINUX)
+    if(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_NETBSD)
         # This option is necessary to ensure that the overloaded delete operator defined inside
         # of the utilcode will be used instead of the standard library delete operator.
         set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic -Bsymbolic-functions")
@@ -39,7 +39,7 @@ else(WIN32)
         # ensure proper resolving of circular references between a subset of the libraries.
         set(START_LIBRARY_GROUP -Wl,--start-group)
         set(END_LIBRARY_GROUP -Wl,--end-group)
-    endif(CLR_CMAKE_PLATFORM_LINUX)
+    endif(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_NETBSD)
 endif(WIN32)
 
 add_library_clr(mscordaccore SHARED ${CLR_DAC_SOURCES})
index 74bc206..4470557 100644 (file)
@@ -65,11 +65,11 @@ if(WIN32)
 
 elseif(CLR_CMAKE_PLATFORM_UNIX)
 
-    if(CLR_CMAKE_PLATFORM_LINUX)
+    if(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_NETBSD)
         # This option is necessary to ensure that the overloaded new/delete operators defined inside
         # of the utilcode will be used instead of the standard library delete operator.
         set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic -Bsymbolic-functions")    
-    endif(CLR_CMAKE_PLATFORM_LINUX)
+    endif(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_NETBSD)
 
     list(APPEND COREDBI_LIBRARIES
         mdhotdata_full
index 0901404..1b7d1fe 100644 (file)
@@ -15,7 +15,7 @@ else()
     set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/coreclr.exports)
     generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE})
 
-    if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+    if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL NetBSD)
         # This option is necessary to ensure that the overloaded delete operator defined inside
         # of the utilcode will be used instead of the standard library delete operator.
         set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic -Bsymbolic-functions")
@@ -30,7 +30,7 @@ else()
         set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive) 
 
         set(EXPORTS_LINKER_OPTION -Wl,--version-script=${EXPORTS_FILE})
-    endif(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+    endif(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL NetBSD)
 
     if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
         # These options are used to force every object to be included even if it's unused.
index fd9af67..06d4616 100644 (file)
@@ -14,9 +14,9 @@ convert_to_absolute_path(DEF_SOURCES1 ${DEF_SOURCES1})
 set(EXPORTS_FILE1 ${CMAKE_CURRENT_BINARY_DIR}/dlltest1.exports)
 generate_exports_file(${DEF_SOURCES1} ${EXPORTS_FILE1})
 
-if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL NetBSD)
     set(EXPORTS_LINKER_OPTION1 -Wl,--version-script=${EXPORTS_FILE1})
-endif(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+endif(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL NetBSD)
 
 if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
     set(EXPORTS_LINKER_OPTION1 -Wl,-exported_symbols_list,${EXPORTS_FILE1})
@@ -46,9 +46,9 @@ convert_to_absolute_path(DEF_SOURCES2 ${DEF_SOURCES2})
 set(EXPORTS_FILE2 ${CMAKE_CURRENT_BINARY_DIR}/dlltest2.exports)
 generate_exports_file(${DEF_SOURCES2} ${EXPORTS_FILE2})
 
-if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL NetBSD)
     set(EXPORTS_LINKER_OPTION2 -Wl,--version-script=${EXPORTS_FILE2})
-endif(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+endif(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL NetBSD)
 
 if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
     set(EXPORTS_LINKER_OPTION2 -Wl,-exported_symbols_list,${EXPORTS_FILE2})
@@ -86,4 +86,3 @@ target_link_libraries(paltest_pal_sxs_test1
    paltest_pal_sxs_test1_dll1
    paltest_pal_sxs_test1_dll2
 )
-