tde_setup_architecture_flags: Add test for liner flag -pie or -ztype=pie.

Signed-off-by: Denis Kozadaev <denis@dilos.org>
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/91/head
Denis Kozadaev 2 years ago committed by Slávek Banko
parent bc1a17dc6f
commit 4e0406ce01
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -16,6 +16,7 @@
################################################# #################################################
include( CheckCXXCompilerFlag ) include( CheckCXXCompilerFlag )
include( CheckLinkerFlag OPTIONAL )
include( TDEVersion ) include( TDEVersion )
@ -2843,7 +2844,29 @@ macro( tde_setup_architecture_flags )
check_cxx_compiler_flag( -fPIE HAVE_PIE_SUPPORT ) check_cxx_compiler_flag( -fPIE HAVE_PIE_SUPPORT )
if( HAVE_PIE_SUPPORT ) if( HAVE_PIE_SUPPORT )
set( TDE_PIE_CFLAGS -fPIE ) set( TDE_PIE_CFLAGS -fPIE )
if( ${CMAKE_VERSION} VERSION_LESS "3.18" )
execute_process(COMMAND "${CMAKE_LINKER}" --help
OUTPUT_VARIABLE __linker_help
ERROR_VARIABLE __linker_help)
if( "${__linker_help}" MATCHES "-pie" )
set( LINKER_PIE_SUPPORT 1 )
elseif( "${__linker_help}" MATCHES "type=type.*pie" )
set( LINKER_ZTYPE_PIE_SUPPORT 1 )
endif( )
unset(__linker_help)
else( )
check_linker_flag(CXX -pie LINKER_PIE_SUPPORT)
if( NOT LINKER_PIE_SUPPORT )
check_linker_flag(CXX -ztype=pie LINKER_ZTYPE_PIE_SUPPORT)
endif()
endif()
if( LINKER_PIE_SUPPORT )
set( TDE_PIE_LDFLAGS -pie ) set( TDE_PIE_LDFLAGS -pie )
endif( LINKER_PIE_SUPPORT )
if( LINKER_ZTYPE_PIE_SUPPORT )
set( TDE_PIE_LDFLAGS -ztype=pie )
endif( LINKER_ZTYPE_PIE_SUPPORT )
endif( HAVE_PIE_SUPPORT ) endif( HAVE_PIE_SUPPORT )
set( _reproducible_cxxflags set( _reproducible_cxxflags

Loading…
Cancel
Save