Skip to content

Commit

Permalink
[Linux] Fix cross-architecture component build configuration for ARM3…
Browse files Browse the repository at this point in the history
…2-target (dotnet/coreclr#8687)

* fix CMakeLists.txt for palrt

* Modify CMakeLists.txt for cross-architecture component configuaration

Add coreclrpal project to fix a dependency issue when CMake configuration

* Allow only x64-host/arm-target for linux

allow x64-host/arm-target only, because pal is not stable for x86 now

* Update build.sh

delete NumProc=1 (inserted for debugging)

* Change x64-host to x86-host for arm-target

JIT correctness problem,
and fix CMake configuration for x86 in pal

* Fix type

* Update CMakeLists.txt

* fix style

* Set x86 when arm-target/x64-host

* fix typo


Commit migrated from dotnet/coreclr@5ef3df8
  • Loading branch information
hseok-oh authored and janvorli committed Dec 23, 2016
1 parent 8d61e86 commit 88a2ab9
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 24 deletions.
10 changes: 4 additions & 6 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CLR_CMAKE_PLATFORM_UNIX 1)
if(CLR_CROSS_COMPONENTS_BUILD)
# CMAKE_HOST_SYSTEM_PROCESSOR returns the value of `uname -p` on host.
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64)
if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm")
set(CLR_CMAKE_PLATFORM_UNIX_X86 1)
else()
Expand Down Expand Up @@ -549,12 +549,10 @@ if(CLR_CMAKE_PLATFORM_UNIX)
endif(CLR_CMAKE_PLATFORM_UNIX)

if(CLR_CMAKE_PLATFORM_UNIX)
add_subdirectory(src/ToolBox/SOS/lldbplugin)
if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
add_subdirectory(src/ToolBox/SOS/lldbplugin)
add_subdirectory(src/pal)
endif(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
add_subdirectory(src/coreclr/hosts)
add_subdirectory(src/ildasm/unixcoreclrloader)
add_subdirectory(src/coreclr/hosts)
add_subdirectory(src/ildasm/unixcoreclrloader)
endif(CLR_CMAKE_PLATFORM_UNIX)

# Add this subdir. We install the headers for the jit.
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function(clr_unknown_arch)
if (WIN32)
message(FATAL_ERROR "Only AMD64, ARM64, ARM and I386 are supported")
elseif(CLR_CROSS_COMPONENTS_BUILD)
message(FATAL_ERROR "Only AMD64, I386 are supported for cross-architecture component")
message(FATAL_ERROR "Only AMD64, I386 host are supported for linux cross-architecture component")
else()
message(FATAL_ERROR "Only AMD64, ARM64 and ARM are supported")
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/pal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ project(COREPAL)
if (WIN32)
set(FEATURE_EVENT_TRACE 1)
endif()
if(CLR_CMAKE_PLATFORM_LINUX AND CLR_CMAKE_PLATFORM_ARCH_AMD64)
if(CLR_CMAKE_PLATFORM_LINUX AND CLR_CMAKE_TARGET_ARCH_AMD64)
set(FEATURE_EVENT_TRACE 1)
endif()

Expand Down
47 changes: 32 additions & 15 deletions src/coreclr/src/pal/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,37 @@ include_directories(include)

# Compile options

if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL AMD64)
set(PAL_CMAKE_PLATFORM_ARCH_AMD64 1)
add_definitions(-D_AMD64_)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
set(PAL_CMAKE_PLATFORM_ARCH_ARM 1)
add_definitions(-D_ARM_)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
set(PAL_CMAKE_PLATFORM_ARCH_ARM64 1)
add_definitions(-D_ARM64_)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
add_definitions(-D_X86_)
if(CLR_CROSS_COMPONENTS_BUILD)
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64)
if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm")
set(PAL_CMAKE_PLATFORM_ARCH_I386 1)
add_definitions(-D_X86_)
else()
set(PAL_CMAKE_PLATFORM_ARCH_AMD64 1)
add_definitions(-D_AMD64_)
endif()
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL i686)
set(PAL_CMAKE_PLATFORM_ARCH_I386 1)
add_definitions(-D_X86_)
else()
message(FATAL_ERROR "Only AMD64, I386 host for cross-architecture component is supported")
endif()
else()
message(FATAL_ERROR "Only ARM and AMD64 is supported")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL AMD64)
set(PAL_CMAKE_PLATFORM_ARCH_AMD64 1)
add_definitions(-D_AMD64_)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
set(PAL_CMAKE_PLATFORM_ARCH_ARM 1)
add_definitions(-D_ARM_)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
set(PAL_CMAKE_PLATFORM_ARCH_ARM64 1)
add_definitions(-D_ARM64_)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
set(PAL_CMAKE_PLATFORM_ARCH_I386 1)
add_definitions(-D_X86_)
else()
message(FATAL_ERROR "Only ARM, AMD64, ARM64 and I386 is supported")
endif()
endif()

if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
Expand Down Expand Up @@ -65,7 +82,7 @@ elseif(PAL_CMAKE_PLATFORM_ARCH_ARM)
elseif(PAL_CMAKE_PLATFORM_ARCH_ARM64)
add_definitions(-DBIT64=1)
add_definitions(-D_WIN64=1)
elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
elseif(PAL_CMAKE_PLATFORM_ARCH_I386)
add_definitions(-DBIT32=1)
endif()

Expand Down Expand Up @@ -105,7 +122,7 @@ elseif(PAL_CMAKE_PLATFORM_ARCH_ARM64)
arch/arm64/exceptionhelper.S
arch/arm64/processor.cpp
)
elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
elseif(PAL_CMAKE_PLATFORM_ARCH_I386)
set(ARCH_SOURCES
arch/i386/context2.S
arch/i386/debugbreak.S
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/palrt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ add_library_clr(palrt
)

# Install the static PAL library for VS
install (TARGETS palrt DESTINATION lib)
_install (TARGETS palrt DESTINATION lib)

0 comments on commit 88a2ab9

Please sign in to comment.