Skip to content

Commit c2a5d9b

Browse files
committed
cmake: disable PIC with NaCl
1 parent c78fe04 commit c2a5d9b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cmake/DaemonFlags.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,16 @@ else()
476476
# Don't set _FORTIFY_SOURCE in debug builds.
477477
endif()
478478

479-
try_c_cxx_flag(FPIC "-fPIC")
479+
if (NOT NACL)
480+
# Saigo reports weird errors when building some cgame and sgame arm nexe with PIC:
481+
# > error: Cannot represent a difference across sections
482+
# > error: expected relocatable expression
483+
# Google-built Saigo crashes when building amd64 cgame with PIC:
484+
# > UNREACHABLE executed at llvm/lib/Target/X86/X86ISelLowering.cpp
485+
# Self-built Saigo doesn't crash, maybe because assertions are disabled.
486+
# PIC is not useful with NaCl under any circumstances, so we don't use PIC with NaCl.
487+
try_c_cxx_flag(FPIC "-fPIC")
488+
endif()
480489

481490
if (USE_HARDENING)
482491
# PNaCl accepts the flags but does not define __stack_chk_guard and __stack_chk_fail.

0 commit comments

Comments
 (0)