--- gcc/config/linux-android.h.bak 2022-04-26 15:52:59.964626084 +1000 +++ gcc/config/linux-android.h 2022-04-26 15:59:36.466061086 +1000 @@ -44,15 +44,18 @@ "%{" NOANDROID "|tno-android-ld:" LINUX_SPEC ";:" ANDROID_SPEC "}" #define ANDROID_LINK_SPEC \ - "%{shared: -Bsymbolic}" + "%{shared: -Bsymbolic} -z noexecstack -z relro -z now" -#define ANDROID_CC1_SPEC \ +#define ANDROID_CC1_SPEC(ANDROID_PIC_DEFAULT) \ "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} " \ - "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}" + "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: " ANDROID_PIC_DEFAULT "}}}}" #define ANDROID_CC1PLUS_SPEC \ - "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} " \ - "%{!frtti:%{!fno-rtti: -fno-rtti}}" + "%{!fexceptions:%{!fno-exceptions: -fexceptions}} " \ + "%{!frtti:%{!fno-rtti: -frtti}}" + +#define ANDROID_ASM_SPEC \ + "--noexecstack" #define ANDROID_LIB_SPEC \ "%{!static: -ldl}"