mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Align ELF sections to 16K boundaries (-Wl,-z,max-page-size=16384)
Even though the initial request was about Android, it is not only about it, but it could be the case for Linux as well (so as Apple M1/... chips) And this should not affect anything, since this is just ELFs Fixes: https://github.com/libevent/libevent/issues/1708
This commit is contained in:
parent
f84896d37f
commit
f01879d5a6
@ -72,6 +72,7 @@ include(CheckPrototypeDefinition)
|
|||||||
include(CheckFunctionKeywords)
|
include(CheckFunctionKeywords)
|
||||||
include(CheckConstExists)
|
include(CheckConstExists)
|
||||||
include(AddCompilerFlags)
|
include(AddCompilerFlags)
|
||||||
|
include(AddLinkerFlags)
|
||||||
include(VersionViaGit)
|
include(VersionViaGit)
|
||||||
|
|
||||||
event_fuzzy_version_from_git()
|
event_fuzzy_version_from_git()
|
||||||
@ -213,6 +214,8 @@ if (EVENT__ENABLE_VERBOSE_DEBUG)
|
|||||||
add_definitions(-DUSE_DEBUG=1)
|
add_definitions(-DUSE_DEBUG=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_linker_flags(-Wl,-z,max-page-size=16384)
|
||||||
|
|
||||||
# make it colorful under ninja-build
|
# make it colorful under ninja-build
|
||||||
if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
|
if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
|
||||||
add_compiler_flags(-fdiagnostics-color=always)
|
add_compiler_flags(-fdiagnostics-color=always)
|
||||||
@ -1751,6 +1754,8 @@ message(STATUS "CMAKE_VERBOSE_MAKEFILE: ${CMAKE_VERBOSE_MAKEFILE}")
|
|||||||
message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
|
message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
|
||||||
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
|
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
|
||||||
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER} (id ${CMAKE_C_COMPILER_ID}, clang ${CLANG}, GNUC ${GNUC}, version ${CMAKE_C_COMPILER_VERSION})")
|
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER} (id ${CMAKE_C_COMPILER_ID}, clang ${CLANG}, GNUC ${GNUC}, version ${CMAKE_C_COMPILER_VERSION})")
|
||||||
|
message(STATUS "CMAKE_SHARED_LINKER_FLAGS:${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
|
message(STATUS "CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
|
||||||
message(STATUS "CMAKE_AR: ${CMAKE_AR}")
|
message(STATUS "CMAKE_AR: ${CMAKE_AR}")
|
||||||
message(STATUS "CMAKE_RANLIB: ${CMAKE_RANLIB}")
|
message(STATUS "CMAKE_RANLIB: ${CMAKE_RANLIB}")
|
||||||
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
|
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
|
||||||
|
@ -108,6 +108,7 @@ PLATFORM_DEPENDENT_SRC = \
|
|||||||
|
|
||||||
CMAKE_FILES = \
|
CMAKE_FILES = \
|
||||||
cmake/AddCompilerFlags.cmake \
|
cmake/AddCompilerFlags.cmake \
|
||||||
|
cmake/AddLinkerFlags.cmake \
|
||||||
cmake/AddEventLibrary.cmake \
|
cmake/AddEventLibrary.cmake \
|
||||||
cmake/CheckConstExists.cmake \
|
cmake/CheckConstExists.cmake \
|
||||||
cmake/CheckFileOffsetBits.c \
|
cmake/CheckFileOffsetBits.c \
|
||||||
|
14
cmake/AddLinkerFlags.cmake
Normal file
14
cmake/AddLinkerFlags.cmake
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
include(CheckLinkerFlag)
|
||||||
|
|
||||||
|
macro(add_linker_flags)
|
||||||
|
foreach(flag ${ARGN})
|
||||||
|
string(REGEX REPLACE "[-.+/:= ]" "_" _flag_esc "${flag}")
|
||||||
|
|
||||||
|
check_linker_flag(C "${flag}" check_c_linker_flag_${_flag_esc})
|
||||||
|
|
||||||
|
if (check_c_linker_flag_${_flag_esc})
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${flag}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
Loading…
x
Reference in New Issue
Block a user