diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index 51a408d285c18c..51c5dda0763d6a 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -204,6 +204,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") set(HOST_LINUX 1) add_definitions(-D_GNU_SOURCE -D_REENTRANT) add_definitions(-D_THREAD_SAFE) + # Enable the "full RELRO" options (RELRO & BIND_NOW) at link time + add_link_options(-Wl,-z,relro) + add_link_options(-Wl,-z,now) elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") set(HOST_LINUX 1) add_definitions(-D_GNU_SOURCE -D_REENTRANT) @@ -737,11 +740,13 @@ endif() ###################################### # EXTRACT VERSION ###################################### -if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/_version.h") - if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/_version.h") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_version.h" "#undef VER_PRODUCTVERSION_STR\n#define VER_PRODUCTVERSION_STR \"42.42.42.42424\"\n") - else() - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_version.h" "static char sccsid[] __attribute__((used)) = \"@(#)Version 42.42.42.42424 @Commit: AAA\";\n") + endif() +else() + if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/version.c") + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/version.c" "static char sccsid[] __attribute__((used)) = \"@(#)Version 42.42.42.42424 @Commit: AAA\";\n") endif() endif() if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" AND NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/NativeVersion.rc") @@ -763,7 +768,7 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/_version.h" product_version_string_line REGEX "VER_PRODUCTVERSION_STR ") string(REGEX REPLACE ".*VER_PRODUCTVERSION_STR *(.*)" "\\1" product_version_string ${product_version_string_line}) else() - file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/_version.h" product_version_string_line REGEX "sccsid") + file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/version.c" product_version_string_line REGEX "sccsid") string(REGEX REPLACE ".*Version *(.*)\";" "\"\\1\"" product_version_string ${product_version_string_line}) endif() diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 54f563fbe2f4e3..975bddf5302341 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -736,13 +736,18 @@ + + _version.h + version.c + + + Properties="NativeVersionFile=$(MonoObjDir)$(NativeVersionFile);RuntimeVersionFile=$(MonoObjDir)runtime_version.h" /> + Properties="NativeVersionFile=$(MonoObjCrossDir)$(NativeVersionFile);RuntimeVersionFile=$(MonoObjCrossDir)runtime_version.h" /> diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt index 5d91ea2a2f73a3..fedc3a5a80d51e 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -317,6 +317,8 @@ endif() if(HOST_WIN32) set(mini_sources "${mini_sources};${PROJECT_BINARY_DIR}/../../NativeVersion.rc") # this is generated by GenerateMonoVersionFile in mono.proj +elseif(NOT HOST_BROWSER) +set(mini_sources "${mini_sources};${PROJECT_BINARY_DIR}/../../version.c") # this is generated by GenerateMonoVersionFile in mono.proj endif() set(monosgen-sources "${metadata_sources};${utils_sources};${sgen_sources};${icu_shim_sources};${mini_sources};${zlib_sources}")