mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 04:01:31 +00:00
Enabled position independent executable for generic GCC/Clang
This affects mostly Linux (and probably MinGW) as default toolchains for Windows and macOS have the corresponding option turned on by default
This commit is contained in:
parent
b8415199c9
commit
25d53ecd2c
2 changed files with 7 additions and 1 deletions
|
@ -234,6 +234,12 @@ else()
|
|||
if( APPLE AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
|
||||
set( ALL_C_FLAGS "-static-libgcc" )
|
||||
endif()
|
||||
|
||||
if( NOT APPLE )
|
||||
# Generic GCC/Clang requires position independent executable to be enabled explicitly
|
||||
set( ALL_C_FLAGS "${ALL_C_FLAGS} -fPIE" )
|
||||
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${REL_LINKER_FLAGS}" )
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// Unfortunately, the Scale function still gets badly handled on 32 bit x86 platforms so it's the last remaining piece of inline assembly
|
||||
|
||||
// GCC inlines
|
||||
#if defined(__GNUC__) && defined(__i386__) && !defined(__clang__)
|
||||
#if defined(__GNUC__) && defined(__i386__) && !defined(__clang__) && !defined(__PIC__)
|
||||
#ifndef alloca
|
||||
// MinGW does not seem to come with alloca defined.
|
||||
#define alloca __builtin_alloca
|
||||
|
|
Loading…
Reference in a new issue