Skip to content

Commit

Permalink
build: add -mbranch-protection=bti to aarch64 hardening flags
Browse files Browse the repository at this point in the history
This is a simpler (less hardening) version of #24123.
Scoped to aarch64 to avoid unused command line option warnings when
building on x86_64.

Related to #19075.
  • Loading branch information
fanquake committed Oct 10, 2023
1 parent 04265ba commit 61a6c3b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,11 @@ if test "$use_hardening" != "no"; then
;;
esac

case $host in
*aarch64*)
AX_CHECK_COMPILE_FLAG([-mbranch-protection=bti], [HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -mbranch-protection=bti"])
;;
esac

dnl When enable_debug is yes, all optimizations are disabled.
dnl However, FORTIFY_SOURCE requires that there is some level of optimization, otherwise it does nothing and just creates a compiler warning.
Expand Down

0 comments on commit 61a6c3b

Please sign in to comment.