Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ endif()
include(DaemonNacl)
if (NACL)
add_library(srclibs-nacl-module EXCLUDE_FROM_ALL ${NACLLIST_MODULE})
set_target_properties(srclibs-nacl-module PROPERTIES POSITION_INDEPENDENT_CODE ${GAME_PIE} FOLDER "libs")
set(LIBS_BASE ${LIBS_BASE} srclibs-nacl-module)
else()
add_library(srclibs-nacl-native EXCLUDE_FROM_ALL ${NACLLIST_NATIVE})
Expand Down
25 changes: 16 additions & 9 deletions cmake/DaemonFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,12 @@ else()
endif()

if (NACL AND USE_NACL_SAIGO AND SAIGO_ARCH STREQUAL "arm")
# This should be set for every build type because build type flags
# are set after the other custom flags and then have the last word.
# DEBUG should already use -O0 anyway.
# Saigo produces broken arm builds when optimizing them.
# See: https://github.com/Unvanquished/Unvanquished/issues/3297
set_c_cxx_flag("-O0" DEBUG)
set_c_cxx_flag("-O0" RELEASE)
set_c_cxx_flag("-O0" RELWITHDEBINFO)
set_c_cxx_flag("-O0" MINSIZEREL)
# When setting this clang-specific option, we don't have to care
# about the ordering of -O options that may be introduced,
# all -O options added to the command line are ignored.
set_c_cxx_flag("-Xclang -disable-llvm-passes")
endif()

# Extra debug flags.
Expand Down Expand Up @@ -476,7 +474,16 @@ else()
# Don't set _FORTIFY_SOURCE in debug builds.
endif()

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

if (USE_HARDENING)
# PNaCl accepts the flags but does not define __stack_chk_guard and __stack_chk_fail.
Expand All @@ -491,7 +498,7 @@ else()
try_c_cxx_flag(FNO_STRICT_OVERFLOW "-fno-strict-overflow")
try_c_cxx_flag(WSTACK_PROTECTOR "-Wstack-protector")

if (NOT NACL OR (NACL AND GAME_PIE))
if (NOT NACL)
# The -pie flag requires -fPIC:
# > ld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
# This flag isn't used on macOS:
Expand Down
9 changes: 0 additions & 9 deletions cmake/DaemonPlatform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,5 @@ else()
message( FATAL_ERROR "Platform not supported" )
endif()

if (NACL AND USE_NACL_SAIGO)
# Saigo clang reports weird errors when building some cgame and sgame arm nexe with PIE.
# Saigo clang crashes when building amd64 cgame with PIE, sgame builds properly though.
set(GAME_PIE 0)
else()
set(GAME_PIE 1)
endif()


include(DaemonArchitecture)
include(DaemonCompiler)
4 changes: 4 additions & 0 deletions src/shared/VMMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "common/StackTrace.h"

#if defined(__native_client__)
#include <unistd.h>
#endif

IPC::Channel VM::rootChannel;

#ifdef BUILD_VM_NATIVE_EXE
Expand Down
Loading