Skip to content

Commit ed598c3

Browse files
committed
cmake: only set -pie if -fPIC is set, also fixes an harmless typo
1 parent bb6f083 commit ed598c3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmake/DaemonFlags.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,13 @@ else()
395395
try_c_cxx_flag(WSTACK_PROTECTOR "-Wstack-protector")
396396

397397
if (NOT NACL OR (NACL AND GAME_PIE))
398-
try_c_cxx_flag(FPIE "-fPIC")
398+
try_c_cxx_flag(FPIC "-fPIC")
399399

400+
# The -pie flag requires -fPIC:
401+
# > ld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
400402
# This flag isn't used on macOS:
401403
# > clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
402-
if (NOT APPLE)
404+
if (FLAG_FPIC AND NOT APPLE)
403405
try_exe_linker_flag(LINKER_PIE "-pie")
404406
endif()
405407
endif()

0 commit comments

Comments
 (0)