Merge pull request #1322

65528ae Always compile Position Independent Code on 64-bit ARMv8 systems (NanoAkron)
This commit is contained in:
Riccardo Spagni 2016-11-12 17:49:31 +02:00
commit 300cb7b27b
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -80,6 +80,7 @@ endif()
if (ARM_ID STREQUAL "aarch64")
set(ARM 1)
set(ARM8 1)
set(BUILD_SHARED_LIBS ON)
endif()
if(WIN32 OR ARM)
@ -182,10 +183,11 @@ option(STATIC "Link libraries statically" ${DEFAULT_STATIC})
# This is a CMake built-in switch that concerns internal libraries
if (NOT DEFINED BUILD_SHARED_LIBS AND NOT STATIC AND CMAKE_BUILD_TYPE_LOWER STREQUAL "debug")
set(BUILD_SHARED_LIBS ON CACHE STRING "Build internal libs as shared")
set(BUILD_SHARED_LIBS ON)
endif()
if (BUILD_SHARED_LIBS)
message(STATUS "Building internal libraries as shared")
message(STATUS "Building internal libraries with position independent code")
set(PIC_FLAG "-fPIC")
else()
message(STATUS "Building internal libraries as static")
@ -378,9 +380,6 @@ else()
set(COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage --coverage")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG}")
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
# is fixed in the code (Issue #847), force compiler to be conservative.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
@ -408,8 +407,8 @@ else()
message(STATUS "AES support disabled")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG}")
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
# is fixed in the code (Issue #847), force compiler to be conservative.