Skip to content

Commit 28f2ec8

Browse files
committed
arch/_common_switches.sh: append -O2 if AB_FLAGS_FTF is enabled
-D_FORTIFY_SOURCE requires optimisation (-O) and may cause build failures if a build system passes only CPPFLAGS but not C/CXXFLAGS (i.e., Binutils and GCC, and we are not sure if this has caused further silent failures elsewhere). Since it would not do much harm to pass our lowest optimisation level on its own, pass -O2 as part of the AB_FLAGS_FTF condition.
1 parent ca26893 commit 28f2ec8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/_common_switches.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if ((AB_FLAGS_SSP)); then CFLAGS_COMMON+=('-fstack-protector-strong' '--param=ss
55
if ((AB_FLAGS_SCP)); then CFLAGS_GCC_COMMON+=('-fstack-clash-protection'); fi
66
if ((AB_FLAGS_RRO)); then LDFLAGS_COMMON+=('-Wl,-z,relro'); fi
77
if ((AB_FLAGS_NOW)); then LDFLAGS_COMMON+=('-Wl,-z,now'); fi
8-
if ((AB_FLAGS_FTF)); then CPPFLAGS_COMMON+=('-U_FORTIFY_SOURCE' '-D_FORTIFY_SOURCE=3'); fi
8+
if ((AB_FLAGS_FTF)); then CPPFLAGS_COMMON+=('-U_FORTIFY_SOURCE' '-D_FORTIFY_SOURCE=3' '-O2'); fi
99
if ((AB_FLAGS_SPECS)); then CFLAGS_GCC_OPTI+=('-specs=/usr/lib/gcc/specs/hardened-cc1'); fi
1010
if ((AB_FLAGS_O3)); then CFLAGS_COMMON_OPTI="${CFLAGS_COMMON_OPTI/O2/O3}"; fi
1111
if ((AB_FLAGS_OS)); then CFLAGS_COMMON_OPTI="${CFLAGS_COMMON_OPTI/O2/Os}"; fi

0 commit comments

Comments
 (0)