From 9887e8cbfde37adabd0f351f9514061b539e0c36 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Wed, 3 Feb 2021 12:13:42 +0100 Subject: [PATCH] Set __USE_FORTIFY_LEVEL for debug builds --- scripts/build/termux_step_setup_toolchain.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/build/termux_step_setup_toolchain.sh b/scripts/build/termux_step_setup_toolchain.sh index bfb8f19ae..ce37b5553 100644 --- a/scripts/build/termux_step_setup_toolchain.sh +++ b/scripts/build/termux_step_setup_toolchain.sh @@ -2,6 +2,7 @@ termux_step_setup_toolchain() { [ "$TERMUX_PKG_METAPACKAGE" = "true" ] && return export CFLAGS="" + export CPPFLAGS="" export LDFLAGS="-L${TERMUX_PREFIX}/lib" export AS=$TERMUX_HOST_PLATFORM-clang @@ -69,13 +70,14 @@ termux_step_setup_toolchain() { LDFLAGS+=" -Wl,-z,relro,-z,now" if [ "$TERMUX_DEBUG" = "true" ]; then - CFLAGS+=" -g3 -O1 -D_FORTIFY_SOURCE=2" + CFLAGS+=" -g3 -O1" + CPPFLAGS+=" -D_FORTIFY_SOURCE=2 -D__USE_FORTIFY_LEVEL=2" else CFLAGS+=" -Oz" fi export CXXFLAGS="$CFLAGS" - export CPPFLAGS="-I${TERMUX_PREFIX}/include" + export CPPFLAGS+=" -I${TERMUX_PREFIX}/include" # If libandroid-support is declared as a dependency, link to it explicitly: if [ "$TERMUX_PKG_DEPENDS" != "${TERMUX_PKG_DEPENDS/libandroid-support/}" ]; then