Skip to content
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

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ef40427
set reset flag to false (#38282)
Anipik Jun 23, 2020
764f742
Half: An IEEE 754 compliant float16 type (#37630) (#38416)
Jun 26, 2020
5ea526f
System.Private.CoreLib: fixed armel build
smx-smx Jul 5, 2020
44c5aeb
eng: allow custom cmake toolchain with TOOLCHAIN_FILE environment var…
smx-smx Jul 5, 2020
367ae6c
eng: use cross TOOLSET_PREFIX for armv7-a
smx-smx Jul 5, 2020
fa169c2
coreclr: Linux 3.x compatibility
smx-smx Jul 5, 2020
0c5217c
pal_networking: added missing casts
smx-smx Jul 5, 2020
d585e35
ignore warning in __atomic_compare_exchange_n (large atomic operation…
smx-smx Jul 6, 2020
8c648bb
CMake: attempting to fix HAVE_GETNAMEINFO_SIGNED_FLAGS check
smx-smx Jul 6, 2020
88e3ca0
CMake: added -Wno-unknown-warning-option
smx-smx Jul 6, 2020
f82962e
Attempting to make build fixes more portable
smx-smx Jul 6, 2020
7d6aa6d
pal: check for pthread_setname_np existance
smx-smx Aug 5, 2020
4a7b5fd
check if -fstack-protector-strong is usable
smx-smx Aug 5, 2020
5c86dfc
pal_console: fixed build with unsigned sigaction flags
smx-smx Aug 6, 2020
d9ac0c1
CMake: don't assume softfp for armel
smx-smx Aug 7, 2020
d205da3
apphost: use libatomic
smx-smx Aug 9, 2020
b46e90c
CI Build fixes attempt
smx-smx Aug 9, 2020
e23ad6c
Fixed pthread_setname_np typo
smx-smx Dec 23, 2020
17a0713
Set ARM_SOFTFP on Tizen only
akoeplinger Feb 24, 2021
76f6c7a
Use HAVE_PT_REGS to check for asm/ptrace.h like we do in other parts …
akoeplinger Feb 24, 2021
ed0976e
Revert unrelated change
akoeplinger Feb 24, 2021
8e0b307
Unify names of variable for fstack-protector-strong support
akoeplinger Feb 24, 2021
67000b7
Add back option for tizen in toolchain.cmake
akoeplinger Feb 24, 2021
4f1386f
armel: fixed FPU-less build
smx-smx Feb 25, 2021
8e9441f
Fix rebase bugs
trylek May 2, 2021
f9b4cf8
Fix detection of HAVE_SIGACTION_ULONG_FLAGS
trylek May 4, 2021
a061df1
Address JanV's PR feedback
trylek May 4, 2021
c20fa5d
Fix the HAVE_SIGACTION_ULONG_FLAGS to be a C++ test
trylek May 5, 2021
fc674e9
Fix __ptrace_request to be an enum
trylek May 5, 2021
66a25ef
Add detection of ptrace first argument type
trylek May 5, 2021
7576b31
Fix the generated property HAVE_PTRACE_ENUM_ARGUMENT on Linux
trylek May 17, 2021
70e9547
Remove the explicit C language specifier from Unix libraries configur…
trylek May 17, 2021
6847e2f
HAVE_SIGACTION_ULONG_FLAGS: updated flags
smx-smx May 19, 2021
c06fdbf
Revert "Remove the explicit C language specifier from Unix libraries …
smx-smx May 19, 2021
96bfcc5
Merge branch 'main' into armel-fixes
smx-smx May 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/common/cross/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$")

add_definitions (-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY})

if(TARGET_ARCH_NAME STREQUAL "armel")
if(DEFINED TIZEN_TOOLCHAIN AND TARGET_ARCH_NAME STREQUAL "armel")
Copy link
Member

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.com.dotnet/arcade since these files are mirrored from there and changes would be reverted in the next arcade update.

add_compile_options(-mfloat-abi=softfp)
smx-smx marked this conversation as resolved.
Show resolved Hide resolved
endif()
elseif(TARGET_ARCH_NAME STREQUAL "x86")
Expand Down
6 changes: 4 additions & 2 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,10 @@ if (CLR_CMAKE_HOST_UNIX)
# We cannot enable "stack-protector-strong" on OS X due to a bug in clang compiler (current version 7.0.2)
add_compile_options(-fstack-protector)
else()
check_cxx_compiler_flag(-fstack-protector-strong COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
if (COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
check_c_compiler_flag_ssp(-fstack-protector-strong C_COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
check_cxx_compiler_flag(-fstack-protector-strong CXX_COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)

if (C_COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG AND CXX_COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
add_compile_options(-fstack-protector-strong)
endif()
endif(CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_MACCATALYST)
Expand Down
4 changes: 3 additions & 1 deletion eng/native/configureplatform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ if (CLR_CMAKE_TARGET_ARCH STREQUAL x64)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armel)
set(CLR_CMAKE_TARGET_ARCH_ARM 1)
set(CLR_CMAKE_TARGET_ARCH_ARMV7L 1)
set(ARM_SOFTFP 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL s390x)
set(CLR_CMAKE_TARGET_ARCH_S390X 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL wasm)
Expand All @@ -294,6 +293,9 @@ if(CLR_CMAKE_TARGET_OS STREQUAL tizen)
set(CLR_CMAKE_TARGET_UNIX 1)
set(CLR_CMAKE_TARGET_LINUX 1)
set(CLR_CMAKE_TARGET_TIZEN_LINUX 1)
if(CLR_CMAKE_TARGET_ARCH_ARMV7L)
set(ARM_SOFTFP 1)
endif()
endif(CLR_CMAKE_TARGET_OS STREQUAL tizen)

if(CLR_CMAKE_TARGET_OS STREQUAL alpine)
Expand Down
3 changes: 2 additions & 1 deletion eng/native/configuretools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER)
if(CLR_CMAKE_TARGET_ANDROID)
set(TOOLSET_PREFIX ${ANDROID_TOOLCHAIN_PREFIX})
elseif(CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD AND (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR
CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL s390x))
CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL s390x OR
CMAKE_SYSTEM_PROCESSOR STREQUAL armv7-a))
set(TOOLSET_PREFIX "${TOOLCHAIN}-")
else()
set(TOOLSET_PREFIX "")
Expand Down
11 changes: 11 additions & 0 deletions eng/native/functions.cmake
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
Copy link
Member

Choose a reason for hiding this comment

The 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 CLR_CMAKE_DISABLE_FSTACK_PROTECTOR_STRONG variable that you could set in your custom toolchain file instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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).
The idea or concept behind the check could be implemented by anyone.

Copy link
Member

Choose a reason for hiding this comment

The 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}")
Expand Down
9 changes: 4 additions & 5 deletions eng/native/gen-buildsys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,13 @@ if [[ "$CROSSCOMPILE" == "1" ]]; then
if [[ "$platform" == "Darwin" ]]; then
cmake_extra_defines="$cmake_extra_defines -DCMAKE_SYSTEM_NAME=Darwin"
else
cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$scriptroot/../common/cross/toolchain.cmake"
if [ -z "$TOOLCHAIN_FILE" ]; then
TOOLCHAIN_FILE="$scriptroot/../common/cross/toolchain.cmake"
fi
cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE"
fi
fi

if [[ "$build_arch" == "armel" ]]; then
cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
smx-smx marked this conversation as resolved.
Show resolved Hide resolved
fi

if ! cmake_command=$(command -v cmake); then
echo "CMake was not found in PATH."
exit 1
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/debug/createdump/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
#pragma once

#cmakedefine HAVE_PROCESS_VM_READV
#cmakedefine HAVE_PTRACE_ENUM_ARGUMENT
13 changes: 13 additions & 0 deletions src/coreclr/debug/createdump/configure.cmake
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)
10 changes: 8 additions & 2 deletions src/coreclr/debug/createdump/crashinfounix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

#include "createdump.h"

#ifdef HAVE_PTRACE_ENUM_ARGUMENT
typedef __ptrace_request ptrace_arg_t;
#else
typedef int ptrace_arg_t;
#endif

bool GetStatus(pid_t pid, pid_t* ppid, pid_t* tgid, std::string* name);

bool
Expand Down Expand Up @@ -33,7 +39,7 @@ CrashInfo::CleanupAndResumeProcess()
// Resume all the threads suspended in EnumerateAndSuspendThreads
for (ThreadInfo* thread : m_threads)
{
if (ptrace(PTRACE_DETACH, thread->Tid(), nullptr, nullptr) != -1)
if (ptrace((ptrace_arg_t)PTRACE_DETACH, thread->Tid(), nullptr, nullptr) != -1)
{
int waitStatus;
waitpid(thread->Tid(), &waitStatus, __WALL);
Expand Down Expand Up @@ -69,7 +75,7 @@ CrashInfo::EnumerateAndSuspendThreads()
if (tid != 0)
{
// Reference: http://stackoverflow.com/questions/18577956/how-to-use-ptrace-to-get-a-consistent-view-of-multiple-threads
if (ptrace(PTRACE_ATTACH, tid, nullptr, nullptr) != -1)
if (ptrace((ptrace_arg_t)PTRACE_ATTACH, tid, nullptr, nullptr) != -1)
{
int waitStatus;
waitpid(tid, &waitStatus, __WALL);
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/debug/createdump/createdump.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ typedef int T_CONTEXT;
#include <sys/wait.h>
#ifndef __APPLE__
#include <sys/procfs.h>
#ifdef HAVE_PT_REGS
#include <asm/ptrace.h>
#elif defined(__linux__)
#include <linux/ptrace.h>
#endif
#endif
#ifdef HAVE_PROCESS_VM_READV
#include <sys/uio.h>
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/pal/src/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ check_library_exists(${PTHREAD_LIBRARY} pthread_getattr_np "" HAVE_PTHREAD_GETAT
check_library_exists(${PTHREAD_LIBRARY} pthread_getcpuclockid "" HAVE_PTHREAD_GETCPUCLOCKID)
check_library_exists(${PTHREAD_LIBRARY} pthread_sigqueue "" HAVE_PTHREAD_SIGQUEUE)
check_library_exists(${PTHREAD_LIBRARY} pthread_getaffinity_np "" HAVE_PTHREAD_GETAFFINITY_NP)
check_library_exists(${PTHREAD_LIBRARY} pthread_setname_np "" HAVE_PTHREAD_SETNAME_NP)

check_function_exists(sigreturn HAVE_SIGRETURN)
check_function_exists(_thread_sys_sigreturn HAVE__THREAD_SYS_SIGRETURN)
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/pal/src/thread/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,7 @@ CorUnix::InternalSetThreadDescription(

// The exact API of pthread_setname_np varies very wildly depending on OS.
// For now, only Linux and macOS are implemented.
#if HAVE_PTHREAD_SETNAME_NP
#if defined(__linux__) || defined(__APPLE__)

palError = InternalGetThreadDataFromHandle(
Expand Down Expand Up @@ -1722,6 +1723,7 @@ CorUnix::InternalSetThreadDescription(
}

#endif //defined(__linux__) || defined(__APPLE__)
#endif //HAVE_PTHREAD_SETNAME_NP

return palError;
}
Expand Down
214 changes: 214 additions & 0 deletions src/installer/corehost/cli/apphost/static/CMakeLists.txt
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}
)
5 changes: 4 additions & 1 deletion src/libraries/Native/Unix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ elseif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET
# We cannot enable "stack-protector-strong" on OS X due to a bug in clang compiler (current version 7.0.2)
add_compile_options(-fstack-protector)
else ()
add_compile_options(-fstack-protector-strong)
check_c_compiler_flag_ssp(-fstack-protector-strong C_COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
if(C_COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG)
add_compile_options(-fstack-protector-strong)
endif()
endif ()

if (CLR_CMAKE_TARGET_LINUX)
Expand Down
Loading