Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdeel Mujahid <adeelbm@outlook.com>2020-06-19 15:50:20 +0300
committerGitHub <noreply@github.com>2020-06-19 15:50:20 +0300
commit43ae9afecb6f8307afe91d73bff7435176beef56 (patch)
treedce1310ba9d6e6e36dc936ea6f11f1e4f3760406 /eng/native
parent85a97b64d7a86e1c8747479a7f2c6df19cf3acd6 (diff)
Add support for illumos cross-compilation (#37753)
Diffstat (limited to 'eng/native')
-rw-r--r--eng/native/configurecompiler.cmake14
-rw-r--r--eng/native/configureplatform.cmake8
-rw-r--r--eng/native/configuretools.cmake7
-rw-r--r--eng/native/functions.cmake14
4 files changed, 36 insertions, 7 deletions
diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake
index a6e6ba45808..a6537bbd9a6 100644
--- a/eng/native/configurecompiler.cmake
+++ b/eng/native/configurecompiler.cmake
@@ -577,4 +577,18 @@ else (CLR_CMAKE_HOST_WIN32)
if (AWK STREQUAL "AWK-NOTFOUND")
message(FATAL_ERROR "AWK not found")
endif()
+
+ # detect linker
+ set(ldVersion ${CMAKE_C_COMPILER};-Wl,--version)
+ execute_process(COMMAND ${ldVersion}
+ ERROR_QUIET
+ OUTPUT_VARIABLE ldVersionOutput)
+
+ if("${ldVersionOutput}" MATCHES "GNU ld" OR "${ldVersionOutput}" MATCHES "GNU gold")
+ set(LD_GNU 1)
+ elseif("${ldVersionOutput}" MATCHES "Solaris Link")
+ set(LD_SOLARIS 1)
+ else(CLR_CMAKE_HOST_OSX)
+ set(LD_OSX 1)
+ endif()
endif(CLR_CMAKE_HOST_WIN32)
diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake
index bbc7877e8f9..8c4ddff8d23 100644
--- a/eng/native/configureplatform.cmake
+++ b/eng/native/configureplatform.cmake
@@ -152,7 +152,7 @@ if(CLR_CMAKE_HOST_OS STREQUAL SunOS)
COMMAND isainfo -n
OUTPUT_VARIABLE SUNOS_NATIVE_INSTRUCTION_SET)
- if(SUNOS_NATIVE_INSTRUCTION_SET MATCHES "amd64")
+ if(SUNOS_NATIVE_INSTRUCTION_SET MATCHES "amd64" OR CMAKE_CROSSCOMPILING)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
set(CMAKE_SYSTEM_PROCESSOR "amd64")
else()
@@ -165,11 +165,11 @@ if(CLR_CMAKE_HOST_OS STREQUAL SunOS)
ERROR_QUIET)
set(CLR_CMAKE_HOST_SUNOS 1)
- if(SUNOS_KERNEL_KIND STREQUAL illumos)
+ if(SUNOS_KERNEL_KIND STREQUAL illumos OR CMAKE_CROSSCOMPILING)
set(CLR_CMAKE_HOST_OS_ILLUMOS 1)
- else(SUNOS_KERNEL_KIND STREQUAL illumos)
+ else(SUNOS_KERNEL_KIND STREQUAL illumos OR CMAKE_CROSSCOMPILING)
set(CLR_CMAKE_HOST_OS_SOLARIS 1)
- endif(SUNOS_KERNEL_KIND STREQUAL illumos)
+ endif(SUNOS_KERNEL_KIND STREQUAL illumos OR CMAKE_CROSSCOMPILING)
endif(CLR_CMAKE_HOST_OS STREQUAL SunOS)
if(CLR_CMAKE_HOST_OS STREQUAL Windows)
diff --git a/eng/native/configuretools.cmake b/eng/native/configuretools.cmake
index 4fb94531d76..0edbe2ee6d0 100644
--- a/eng/native/configuretools.cmake
+++ b/eng/native/configuretools.cmake
@@ -34,17 +34,18 @@ if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER)
"${TOOLSET_PREFIX}${exec}")
if (EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND")
- message(FATAL_ERROR "Unable to find toolchain executable for: ${exec}.")
+ message(FATAL_ERROR "Unable to find toolchain executable. Name: ${exec}, Prefix: ${TOOLSET_PREFIX}.")
endif()
set(${var} ${EXEC_LOCATION_${exec}} PARENT_SCOPE)
endfunction()
locate_toolchain_exec(ar CMAKE_AR)
- locate_toolchain_exec(link CMAKE_LINKER)
locate_toolchain_exec(nm CMAKE_NM)
- if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ if(CMAKE_C_COMPILER_ID MATCHES "GNU")
locate_toolchain_exec(ranlib CMAKE_RANLIB)
+ else()
+ locate_toolchain_exec(link CMAKE_LINKER)
endif()
if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND (NOT CLR_CMAKE_TARGET_ANDROID OR CROSS_ROOTFS))
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake
index 49b0064499e..44790724ea0 100644
--- a/eng/native/functions.cmake
+++ b/eng/native/functions.cmake
@@ -162,6 +162,20 @@ function(preprocess_compile_asm)
set(${COMPILE_ASM_OUTPUT_OBJECTS} ${ASSEMBLED_OBJECTS} PARENT_SCOPE)
endfunction()
+function(set_exports_linker_option exports_filename)
+ if(LD_GNU OR LD_SOLARIS)
+ # Add linker exports file option
+ if(LD_SOLARIS)
+ set(EXPORTS_LINKER_OPTION -Wl,-M,${exports_filename} PARENT_SCOPE)
+ else()
+ set(EXPORTS_LINKER_OPTION -Wl,--version-script=${exports_filename} PARENT_SCOPE)
+ endif()
+ elseif(LD_OSX)
+ # Add linker exports file option
+ set(EXPORTS_LINKER_OPTION -Wl,-exported_symbols_list,${exports_filename} PARENT_SCOPE)
+ endif()
+endfunction()
+
function(generate_exports_file)
set(INPUT_LIST ${ARGN})
list(GET INPUT_LIST -1 outputFilename)