···16881688sorry, unimplemented: __builtin_clear_padding not supported for variable length aggregates
16891689```
1690169016911691+#### `glibcxxassertions` {#glibcxxassertions}
16921692+16931693+Adds the `-D_GLIBCXX_ASSERTIONS` compiler flag. This flag only has an effect on libstdc++ targets, and when defined, enables extra error checking in the form of precondition assertions, such as bounds checking in c++ strings and null pointer checks when dereferencing c++ smart pointers.
16941694+16951695+These checks may have an impact on performance in some cases.
16961696+16911697#### `pacret` {#pacret}
1692169816931699This flag adds the `-mbranch-protection=pac-ret` compiler option on aarch64-linux targets. This uses ARM v8.3's Pointer Authentication feature to sign function return pointers before adding them to the stack. The pointer's authenticity is then validated before returning to its destination. This dramatically increases the difficulty of ROP exploitation techniques.
+5-1
pkgs/build-support/cc-wrapper/add-hardening.sh
···525253535454if (( "${NIX_DEBUG:-0}" >= 1 )); then
5555- declare -a allHardeningFlags=(fortify fortify3 shadowstack stackprotector stackclashprotection nostrictaliasing pacret strictflexarrays1 strictflexarrays3 pie pic strictoverflow format trivialautovarinit zerocallusedregs)
5555+ declare -a allHardeningFlags=(fortify fortify3 shadowstack stackprotector stackclashprotection nostrictaliasing pacret strictflexarrays1 strictflexarrays3 pie pic strictoverflow glibcxxassertions format trivialautovarinit zerocallusedregs)
5656 declare -A hardeningDisableMap=()
57575858 # Determine which flags were effectively disabled so we can report below.
···110110 pacret)
111111 if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling pacret >&2; fi
112112 hardeningCFlagsBefore+=('-mbranch-protection=pac-ret')
113113+ ;;
114114+ glibcxxassertions)
115115+ if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling glibcxxassertions >&2; fi
116116+ hardeningCFlagsBefore+=('-D_GLIBCXX_ASSERTIONS')
113117 ;;
114118 stackprotector)
115119 if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling stackprotector >&2; fi