-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support generic Armel builds #38798
Support generic Armel builds #38798
Changes from 32 commits
ef40427
764f742
5ea526f
44c5aeb
367ae6c
fa169c2
0c5217c
d585e35
8c648bb
88e3ca0
f82962e
7d6aa6d
4a7b5fd
5c86dfc
d9ac0c1
d205da3
b46e90c
e23ad6c
17a0713
76f6c7a
ed0976e
8e0b307
67000b7
4f1386f
8e9441f
f9b4cf8
a061df1
c20fa5d
fc674e9
66a25ef
7576b31
70e9547
6847e2f
c06fdbf
96bfcc5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
include(CheckCSourceCompiles) | ||
|
||
# License: https://github.com/clibs/cmocka/blob/master/cmake/Modules/COPYING-CMAKE-SCRIPTS | ||
# https://github.com/clibs/cmocka/blob/master/cmake/Modules/CheckCCompilerFlagSSP.cmake | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if we can just link to the license here, afaik we'd need to embed the license text. @smx-smx what if we added an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That could also work, but i wonder if this discussion even makes sense for the individual (one) line of code that is the check in question (but i'm not a lawyer). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah it seems pretty trivial but I'm not a lawyer either :) |
||
function(check_c_compiler_flag_ssp _FLAG _RESULT) | ||
smx-smx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") | ||
set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") | ||
check_c_source_compiles("int main(int argc, char **argv) { char buffer[256]; return buffer[argc]=0;}" ${_RESULT}) | ||
set(CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") | ||
endfunction(check_c_compiler_flag_ssp) | ||
|
||
function(clr_unknown_arch) | ||
if (WIN32) | ||
message(FATAL_ERROR "Only AMD64, ARM64, ARM and I386 are supported. Found: ${CMAKE_SYSTEM_PROCESSOR}") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
#pragma once | ||
|
||
#cmakedefine HAVE_PROCESS_VM_READV | ||
#cmakedefine HAVE_PTRACE_ENUM_ARGUMENT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
check_function_exists(process_vm_readv HAVE_PROCESS_VM_READV) | ||
|
||
set(CMAKE_EXTRA_INCLUDE_FILES asm/ptrace.h) | ||
check_type_size("struct pt_regs" PT_REGS) | ||
set(CMAKE_EXTRA_INCLUDE_FILES) | ||
|
||
check_cxx_source_compiles(" | ||
#include <sys/ptrace.h> | ||
|
||
int main(void) | ||
{ | ||
ptrace((__ptrace_request)PTRACE_ATTACH, 0, 0, 0); | ||
return 0; | ||
}" HAVE_PTRACE_ENUM_ARGUMENT) | ||
|
||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
# Licensed to the .NET Foundation under one or more agreements. | ||
# The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
project(singlefilehost) | ||
set(DOTNET_PROJECT_NAME "singlefilehost") | ||
|
||
# Add RPATH to the apphost binary that allows using local copies of shared libraries | ||
# dotnet core depends on for special scenarios when system wide installation of such | ||
# dependencies is not possible for some reason. | ||
# This cannot be enabled for MacOS (Darwin) since its RPATH works in a different way, | ||
# doesn't apply to libraries loaded via dlopen and most importantly, it is not transitive. | ||
if (NOT CLR_CMAKE_TARGET_OSX) | ||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) | ||
set(CMAKE_INSTALL_RPATH "\$ORIGIN/netcoredeps") | ||
endif() | ||
|
||
set(SKIP_VERSIONING 1) | ||
|
||
include_directories(..) | ||
include_directories(../../json) | ||
|
||
set(SOURCES | ||
../bundle_marker.cpp | ||
./hostfxr_resolver.cpp | ||
./hostpolicy_resolver.cpp | ||
) | ||
|
||
set(HEADERS | ||
../bundle_marker.h | ||
../../../hostfxr_resolver.h | ||
) | ||
|
||
if(CLR_CMAKE_TARGET_WIN32) | ||
list(APPEND SOURCES | ||
../apphost.windows.cpp) | ||
|
||
list(APPEND HEADERS | ||
../apphost.windows.h) | ||
endif() | ||
|
||
include(../../exe.cmake) | ||
include(configure.cmake) | ||
|
||
add_definitions(-DFEATURE_APPHOST=1) | ||
add_definitions(-DFEATURE_STATIC_HOST=1) | ||
|
||
# Disable manifest generation into the file .exe on Windows | ||
if(CLR_CMAKE_TARGET_WIN32) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY | ||
LINK_FLAGS "/MANIFEST:NO" | ||
) | ||
endif() | ||
|
||
# Specify non-default Windows libs to be used for Arm/Arm64 builds | ||
if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)) | ||
target_link_libraries(singlefilehost Advapi32.lib shell32.lib) | ||
endif() | ||
|
||
# Path like: artifacts/bin/coreclr/Windows_NT.x64.Release/lib or | ||
# /root/runtime/artifacts/transport/coreclr/lib | ||
set(CORECLR_STATIC_LIB_LOCATION "${CORECLR_ARTIFACTS}/lib") | ||
|
||
message ("Looking for coreclr_static lib at location: '${CORECLR_STATIC_LIB_LOCATION}'.") | ||
|
||
if(CLR_CMAKE_TARGET_WIN32) | ||
set(CORECLR_LIBRARIES | ||
# Disable superhost on Win32 for now. | ||
# ${CORECLR_STATIC_LIB_LOCATION}/coreclr_static.lib | ||
${STATIC_MT_CRT_LIB} | ||
${STATIC_MT_VCRT_LIB} | ||
kernel32.lib | ||
advapi32.lib | ||
ole32.lib | ||
oleaut32.lib | ||
uuid.lib | ||
user32.lib | ||
version.lib | ||
shlwapi.lib | ||
bcrypt.lib | ||
RuntimeObject.lib | ||
) | ||
elseif(CLR_CMAKE_TARGET_LINUX) | ||
set(CORECLR_LIBRARIES | ||
${CORECLR_STATIC_LIB_LOCATION}/libcoreclr_static.a | ||
${CORECLR_STATIC_LIB_LOCATION}/libcoreclrpal.a | ||
${CORECLR_STATIC_LIB_LOCATION}/libpalrt.a | ||
${CORECLR_STATIC_LIB_LOCATION}/libeventprovider.a | ||
${CORECLR_STATIC_LIB_LOCATION}/libnativeresourcestring.a | ||
) | ||
|
||
# currently linking coreclr into the singlefilehost is only supported on linux | ||
# the following code here would be needed if/when BSD and OSX are supported too | ||
# | ||
# if(CLR_CMAKE_TARGET_OSX) | ||
# find_library(COREFOUNDATION CoreFoundation) | ||
# find_library(CORESERVICES CoreServices) | ||
# find_library(SECURITY Security) | ||
# find_library(SYSTEM System) | ||
# | ||
# LIST(APPEND CORECLR_LIBRARIES | ||
# ${COREFOUNDATION} | ||
# ${CORESERVICES} | ||
# ${SECURITY} | ||
# ${SYSTEM} | ||
# ) | ||
# endif(CLR_CMAKE_TARGET_OSX) | ||
# | ||
# # On OSX and *BSD, we use the libunwind that's part of the OS | ||
# if(CLR_CMAKE_TARGET_FREEBSD) | ||
# find_unwind_libs(UNWIND_LIBS) | ||
# | ||
# LIST(APPEND CORECLR_LIBRARIES | ||
# ${UNWIND_LIBS} | ||
# ) | ||
# endif(CLR_CMAKE_TARGET_FREEBSD) | ||
# | ||
# if(CLR_CMAKE_TARGET_NETBSD) | ||
# find_library(KVM kvm) | ||
# | ||
# LIST(APPEND CORECLR_LIBRARIES | ||
# ${KVM} | ||
# ) | ||
# endif(CLR_CMAKE_TARGET_NETBSD) | ||
endif(CLR_CMAKE_TARGET_WIN32) | ||
|
||
# Path like: artifacts/bin/native/net5.0-Linux-Release-arm/ | ||
set(NATIVE_LIBS_LOCATION "${NATIVE_LIBS_ARTIFACTS}") | ||
message ("Looking for native libs at location: '${NATIVE_LIBS_LOCATION}'.") | ||
|
||
if(NOT CLR_CMAKE_TARGET_LINUX) | ||
set(NATIVE_LIBS | ||
# Native libs linked into singlefilehost is supported only on Linux for now. | ||
# if/when BSD and OSX are supported too, consider the commented code sections below. | ||
) | ||
else() | ||
set(NATIVE_LIBS | ||
${NATIVE_LIBS_LOCATION}/libSystem.IO.Compression.Native.a | ||
${NATIVE_LIBS_LOCATION}/libSystem.Native.a | ||
${NATIVE_LIBS_LOCATION}/libSystem.Net.Security.Native.a | ||
${NATIVE_LIBS_LOCATION}/libSystem.Security.Cryptography.Native.OpenSsl.a | ||
) | ||
|
||
find_package(ZLIB REQUIRED) | ||
|
||
# Additional requirements for System.System.IO.Compression.Native | ||
# | ||
# if (CLR_CMAKE_TARGET_SUNOS) | ||
# set(ZLIB_LIBRARIES z m) | ||
# elseif (CLR_CMAKE_TARGET_UNIX) | ||
# find_package(ZLIB REQUIRED) | ||
# endif () | ||
|
||
# Additional requirements for System.Net.Security.Native | ||
if (HAVE_GSSFW_HEADERS) | ||
find_library(LIBGSS NAMES GSS) | ||
if(LIBGSS STREQUAL LIBGSS-NOTFOUND) | ||
message(FATAL_ERROR "Cannot find GSS.Framework and System.Net.Security.Native cannot build without it. Try installing GSS.Framework (or the appropriate package for your platform)") | ||
endif() | ||
elseif(HAVE_HEIMDAL_HEADERS) | ||
find_library(LIBGSS NAMES gssapi) | ||
if(LIBGSS STREQUAL LIBGSS-NOTFOUND) | ||
message(FATAL_ERROR "Cannot find libgssapi and System.Net.Security.Native cannot build without it. Try installing heimdal (or the appropriate package for your platform)") | ||
endif() | ||
else() | ||
find_library(LIBGSS NAMES gssapi_krb5) | ||
if(LIBGSS STREQUAL LIBGSS-NOTFOUND) | ||
message(FATAL_ERROR "Cannot find libgssapi_krb5 and System.Net.Security.Native cannot build without it. Try installing libkrb5-dev (or the appropriate package for your platform)") | ||
endif() | ||
endif() | ||
|
||
# Additional requirements for System.Native | ||
if (CLR_CMAKE_TARGET_LINUX AND NOT CLR_CMAKE_TARGET_ANDROID) | ||
set(NATIVE_LIBS_EXTRA | ||
rt atomic | ||
) | ||
# elseif (CLR_CMAKE_TARGET_FREEBSD) | ||
# set(NATIVE_LIBS_EXTRA | ||
# pthread | ||
# ) | ||
# find_library(INOTIFY_LIBRARY inotify HINTS /usr/local/lib) | ||
# if(NOT (INOTIFY_LIBRARY STREQUAL INOTIFY_LIBRARY-NOTFOUND)) | ||
# LIST(APPEND NATIVE_LIBS_EXTRA | ||
# ${INOTIFY_LIBRARY} | ||
# ) | ||
# endif () | ||
# elseif (CLR_CMAKE_TARGET_SUNOS) | ||
# set(NATIVE_LIBS_EXTRA | ||
# socket | ||
# ) | ||
endif () | ||
|
||
if(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS) | ||
# These options are used to force every object to be included even if it's unused. | ||
set(START_WHOLE_ARCHIVE -Wl,--whole-archive) | ||
set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive) | ||
endif(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS) | ||
endif(NOT CLR_CMAKE_TARGET_LINUX) | ||
|
||
set_property(TARGET singlefilehost PROPERTY ENABLE_EXPORTS 1) | ||
|
||
target_link_libraries(singlefilehost | ||
libhostfxr_static | ||
libhostpolicy_static | ||
libhostcommon | ||
${CORECLR_LIBRARIES} | ||
|
||
${ZLIB_LIBRARIES} | ||
${LIBGSS} | ||
${NATIVE_LIBS_EXTRA} | ||
|
||
${START_WHOLE_ARCHIVE} | ||
${NATIVE_LIBS} | ||
${END_WHOLE_ARCHIVE} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change in eng/common will need to be done in https://github.aaakk.us.kg.dotnet/arcade since these files are mirrored from there and changes would be reverted in the next arcade update.