Merge bitcoin/bitcoin#30433: build: add standard branch-protection to hardening flags for aarch64-linux
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 13 native, x86_64, no depends, sqlite only, gui (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run

001b1cf010 build: use standard branch-protection for aarch64-linux (fanquake)

Pull request description:

  Use `-mbranch-protection=standard` when targetting `*aarch64-*-linux*`.
  Part of #24123, but this flag can already be used on a best effort basis.

  Note that this flag is also already used by default, in the toolchain, on various distros (i.e Fedora).

ACKs for top commit:
  hebasto:
    ACK 001b1cf010.
  TheCharlatan:
    ACK 001b1cf010

Tree-SHA512: 2d7ae60f59921a62d51139cb0fd5cecbed4f63266564b2623b7d160f5b0c2c42c78ef8aeff787f485eccc46a9ffd5da70023ec093df6add7c982e0d48a1601b5
This commit is contained in:
merge-script 2024-09-13 15:29:13 +01:00
commit 06a9f7789e
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -506,7 +506,11 @@ if(ENABLE_HARDENING)
endif()
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
try_append_cxx_flags("-mbranch-protection=bti" TARGET hardening_interface SKIP_LINK)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
try_append_cxx_flags("-mbranch-protection=bti" TARGET hardening_interface SKIP_LINK)
else()
try_append_cxx_flags("-mbranch-protection=standard" TARGET hardening_interface SKIP_LINK)
endif()
endif()
try_append_linker_flag("-Wl,--enable-reloc-section" TARGET hardening_interface)