Skip to content

Commit

Permalink
cmake: Add -pie to CMAKE_EXE_LINKER_FLAGS
Browse files Browse the repository at this point in the history
Without this, rpmlint (on openSUSE Tumbleweed) fails with:

ceph-radosgw.x86_64: E: non-position-independent-executable
(Badness: 10000) /usr/bin/radosgw
This executable must be position independent.  Check that it
is built with -fPIE/-fpie in compiler flags and -pie in linker
flags.

Signed-off-by: Tim Serong <[email protected]>
  • Loading branch information
tserong committed Aug 17, 2016
1 parent 80d914f commit 9e705be
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Werror=format-security -fno
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
add_definitions("-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-export-dynamic")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -rdynamic -Wl,-export-dynamic -export-dynamic")
Expand Down

0 comments on commit 9e705be

Please sign in to comment.