LTO compiler and linker fixes (#1676)

* Guard the LTO feature in a CMAKE option and document possible issues of using it.
master
faluco 4 years ago committed by GitHub
parent 14289ebcc6
commit 12e82a947f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -93,6 +93,12 @@ option(ENABLE_TIMEPROF "Enable time profiling" ON)
option(FORCE_32BIT "Add flags to force 32 bit compilation" OFF) option(FORCE_32BIT "Add flags to force 32 bit compilation" OFF)
# Users that want to try this feature need to make sure the lto plugin is
# loaded by bintools (ar, nm, ...). Older versions of bintools will not do
# it automatically so it is necessary to use the gcc wrappers of the compiler
# (gcc-ar, gcc-nm, ...).
option(BUILD_WITH_LTO "Enable LTO (experimental)" OFF)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
set(GCC_ARCH armv8-a CACHE STRING "GCC compile for specific architecture.") set(GCC_ARCH armv8-a CACHE STRING "GCC compile for specific architecture.")
message(STATUS "Detected aarch64 processor") message(STATUS "Detected aarch64 processor")
@ -370,6 +376,10 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
else(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo") else(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -fno-trapping-math -fno-math-errno -DBUILD_TYPE_RELEASE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -fno-trapping-math -fno-math-errno -DBUILD_TYPE_RELEASE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fno-trapping-math -fno-math-errno -DBUILD_TYPE_RELEASE") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fno-trapping-math -fno-math-errno -DBUILD_TYPE_RELEASE")
if(BUILD_WITH_LTO)
ADD_C_COMPILER_FLAG_IF_AVAILABLE(-flto HAVE_FLTO)
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-flto HAVE_FLTO)
endif(BUILD_WITH_LTO)
endif(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo") endif(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
endif(${CMAKE_BUILD_TYPE} STREQUAL "Debug") endif(${CMAKE_BUILD_TYPE} STREQUAL "Debug")

@ -102,6 +102,7 @@ typedef struct MAC_Context_Info_t {
/* Context information for every NAS PDU that will be logged */ /* Context information for every NAS PDU that will be logged */
typedef struct NAS_Context_Info_s { typedef struct NAS_Context_Info_s {
// No Context yet // No Context yet
unsigned char dummy;
} NAS_Context_Info_t; } NAS_Context_Info_t;
#define MAC_NR_START_STRING "mac-nr" #define MAC_NR_START_STRING "mac-nr"
@ -182,6 +183,7 @@ typedef struct {
/* Context information for every S1AP PDU that will be logged */ /* Context information for every S1AP PDU that will be logged */
typedef struct S1AP_Context_Info_s { typedef struct S1AP_Context_Info_s {
// No Context yet // No Context yet
unsigned char dummy;
} S1AP_Context_Info_t; } S1AP_Context_Info_t;
#ifdef __cplusplus #ifdef __cplusplus

Loading…
Cancel
Save