diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-10-09 23:43:02 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-10-14 22:49:47 +0000 |
commit | 95804d94e8cc07c6361287ff7ade0600f11b2078 (patch) | |
tree | d63751c80df4186acb767fb5a4a2d3a5d982f939 | |
parent | 14085e043a2b7f3b53d1c57fe2a06beb691c95dc (diff) |
cmake: avoid adding -fPIE to libraries (fixes gcc 4.7)
On Debian Wheezy, the cmake build would fail with:
/usr/bin/ld: CMakeFiles/wsutil.dir/privileges.c.o: relocation
R_X86_64_PC32 against symbol `started_with_special_privs' can not be
used when making a shared object; recompile with -fPIC
Issue was introduced with v1.99.10rc0-222-g3fb1d68 ("cmake: Enable PIE
when it is available by default").
Bug: 11587
Change-Id: I62eec8d1db020128eeeb77b38e3316abf71e6e6a
Reviewed-on: https://code.wireshark.org/review/10916
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r-- | CMakeLists.txt | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 173c2ab5fd..7d06629465 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,6 +226,9 @@ if( NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND set( DUMPCAP_INSTALL_OPTION ) endif() +# Always enable -fPIE (or -fPIC). -pie is added below for non-MSVC. +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + if( CMAKE_C_COMPILER_ID MATCHES "MSVC") if (MSVC10) set(MSC_VER_REQUIRED 1600) @@ -346,7 +349,6 @@ else() -fwrapv -fno-strict-overflow -fno-delete-null-pointer-checks - -fPIE -Wvla -Waddress -Wattributes @@ -568,7 +570,7 @@ endif() if(NOT CMAKE_C_COMPILER_ID MATCHES "MSVC") set(WIRESHARK_LD_FLAGS -Wl,--as-needed - -fPIE -pie + -pie # -flto # -fwhopr # -fwhole-program @@ -871,9 +873,6 @@ if(HAVE_LIBZLIB) endif() if (Qt5Widgets_FOUND) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") - if (Qt5_POSITION_INDEPENDENT_CODE) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) - endif() set (QT_FOUND ON) set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES}) if(Qt5Multimedia_FOUND) |