Skip to content

Commit

Permalink
try fixing macos gcc builds 7
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Jul 12, 2024
1 parent faf6296 commit fc1a879
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions _build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -916,25 +916,27 @@ build_single_target() {
_CFLAGS_GLOBAL+=' -fno-omit-frame-pointer'
_CXXFLAGS_GLOBAL+=' -fno-omit-frame-pointer'

# https://fedoraproject.org/wiki/Security_Features_Matrix
# RISC-V: https://gcc.gnu.org/onlinedocs/gcc/RISC-V-Options.html
if [ "${_CPU}" = 'x64' ] || \
[ "${_CPU}" = 'x86' ]; then
# https://maskray.me/blog/2022-12-18-control-flow-integrity
_CFLAGS_GLOBAL+=' -fcf-protection=full'
_CXXFLAGS_GLOBAL+=' -fcf-protection=full'
if [ "${_OS}" = 'linux' ]; then
# https://github.com/llvm/llvm-project/issues/44828
# https://reviews.llvm.org/D59780
# https://github.com/llvm/llvm-project/commit/7cd429f27d4886bb841ed0e3702e970f5f6cccd1
_LDFLAGS_GLOBAL+=' -Wl,-z,cet-report=warning -Wl,-z,force-ibt,-z,shstk'
elif [ "${_OS}" = 'win' ] && [ "${_CC}" = 'llvm' ]; then
_LDFLAGS_GLOBAL+=' -Wl,-Xlink=-cetcompat'
if [ "${_OS}" != 'mac' ] || [ "${_CC}" != 'gcc' ]; then # skip for mac-gcc
# https://fedoraproject.org/wiki/Security_Features_Matrix
# RISC-V: https://gcc.gnu.org/onlinedocs/gcc/RISC-V-Options.html
if [ "${_CPU}" = 'x64' ] || \
[ "${_CPU}" = 'x86' ]; then
# https://maskray.me/blog/2022-12-18-control-flow-integrity
_CFLAGS_GLOBAL+=' -fcf-protection=full'
_CXXFLAGS_GLOBAL+=' -fcf-protection=full'
if [ "${_OS}" = 'linux' ]; then
# https://github.com/llvm/llvm-project/issues/44828
# https://reviews.llvm.org/D59780
# https://github.com/llvm/llvm-project/commit/7cd429f27d4886bb841ed0e3702e970f5f6cccd1
_LDFLAGS_GLOBAL+=' -Wl,-z,cet-report=warning -Wl,-z,force-ibt,-z,shstk'
elif [ "${_OS}" = 'win' ] && [ "${_CC}" = 'llvm' ]; then
_LDFLAGS_GLOBAL+=' -Wl,-Xlink=-cetcompat'
fi
elif [ "${_CPU}" = 'a64' ]; then
# https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html
_CFLAGS_GLOBAL+=' -mbranch-protection=standard'
_CXXFLAGS_GLOBAL+=' -mbranch-protection=standard'
fi
elif [ "${_CPU}" = 'a64' ]; then
# https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html
_CFLAGS_GLOBAL+=' -mbranch-protection=standard'
_CXXFLAGS_GLOBAL+=' -mbranch-protection=standard'
fi

_CMAKE_GLOBAL+=' -DCMAKE_INSTALL_MESSAGE=NEVER'
Expand Down

0 comments on commit fc1a879

Please sign in to comment.