Build setuid binaries with PIE flags

(cherry picked from commit 08c6f54d6f)
v3.5.13-sru
Slávek Banko 10 years ago
parent fd91f2b33b
commit 7c79da6333

@ -13,6 +13,7 @@
################################################# #################################################
include( KDE3Macros ) # we will need this module for a while include( KDE3Macros ) # we will need this module for a while
include( CheckCXXCompilerFlag )
################################################# #################################################
@ -887,6 +888,12 @@ macro( tde_add_executable _arg_target )
add_dependencies( ${_target} ${_dependencies} ) add_dependencies( ${_target} ${_dependencies} )
endif( _dependencies ) endif( _dependencies )
# set PIE flags for setuid binaries
if( _setuid )
set_target_properties( ${_target} PROPERTIES COMPILE_FLAGS ${TDE_PIE_CFLAGS} )
set_target_properties( ${_target} PROPERTIES LINK_FLAGS ${TDE_PIE_LDFLAGS} )
endif( _setuid )
# set destination directory # set destination directory
if( _destination ) if( _destination )
if( _setuid ) if( _setuid )
@ -1388,4 +1395,10 @@ macro( tde_setup_architecture_flags )
else( ) else( )
set( LINKER_IMMEDIATE_BINDING_FLAGS "" CACHE INTERNAL "" FORCE ) set( LINKER_IMMEDIATE_BINDING_FLAGS "" CACHE INTERNAL "" FORCE )
endif( ) endif( )
check_cxx_compiler_flag( -fPIE HAVE_PIE_SUPPORT )
if( HAVE_PIE_SUPPORT )
set( TDE_PIE_CFLAGS -fPIE )
set( TDE_PIE_LDFLAGS -pie )
endif( HAVE_PIE_SUPPORT )
endmacro( ) endmacro( )

Loading…
Cancel
Save