diff --git a/CMakeLists.txt b/CMakeLists.txt index dfc8c4e21..d3bd90c8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,6 +93,12 @@ option(ENABLE_TIMEPROF "Enable time profiling" ON) 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") set(GCC_ARCH armv8-a CACHE STRING "GCC compile for specific architecture.") 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") 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") + 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 "Debug") diff --git a/lib/include/srslte/common/pcap.h b/lib/include/srslte/common/pcap.h index 6cdc44f88..2642b7863 100644 --- a/lib/include/srslte/common/pcap.h +++ b/lib/include/srslte/common/pcap.h @@ -102,6 +102,7 @@ typedef struct MAC_Context_Info_t { /* Context information for every NAS PDU that will be logged */ typedef struct NAS_Context_Info_s { // No Context yet + unsigned char dummy; } NAS_Context_Info_t; #define MAC_NR_START_STRING "mac-nr" @@ -182,6 +183,7 @@ typedef struct { /* Context information for every S1AP PDU that will be logged */ typedef struct S1AP_Context_Info_s { // No Context yet + unsigned char dummy; } S1AP_Context_Info_t; #ifdef __cplusplus