diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2013-04-02 18:50:36 +0800 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2013-04-02 19:01:03 +0800 |
commit | 5c602438be54c0802c21b299ab8bd94efbfc0c70 (patch) | |
tree | c3b72d35b5c5e42c7f95b32870d2663cbdba2f63 /gcc-4.8/gcc | |
parent | 6ce5868afdf35ad36ca451492fa0541e881d4938 (diff) | |
download | toolchain_gcc-5c602438be54c0802c21b299ab8bd94efbfc0c70.tar.gz toolchain_gcc-5c602438be54c0802c21b299ab8bd94efbfc0c70.tar.bz2 toolchain_gcc-5c602438be54c0802c21b299ab8bd94efbfc0c70.zip |
[4.8] Enable assembler linker default for security
Used to be local NDK patch at $NDK/build/tools/toolchain-patches/
gcc/0009-Enable-assembler-linker-default-for-security.patch
See 7e66b0108987a56a58c6150672fe7cf8cf88e69a
Change-Id: Ia668c962b7251dd673cc028dac8a111b1aeeb47d
Diffstat (limited to 'gcc-4.8/gcc')
-rw-r--r-- | gcc-4.8/gcc/config/arm/elf.h | 6 | ||||
-rw-r--r-- | gcc-4.8/gcc/config/arm/linux-eabi.h | 5 | ||||
-rw-r--r-- | gcc-4.8/gcc/config/i386/gnu-user.h | 3 | ||||
-rw-r--r-- | gcc-4.8/gcc/config/linux-android.h | 5 | ||||
-rw-r--r-- | gcc-4.8/gcc/config/mips/gnu-user.h | 3 |
5 files changed, 17 insertions, 5 deletions
diff --git a/gcc-4.8/gcc/config/arm/elf.h b/gcc-4.8/gcc/config/arm/elf.h index 5e21a0842..96fadebc3 100644 --- a/gcc-4.8/gcc/config/arm/elf.h +++ b/gcc-4.8/gcc/config/arm/elf.h @@ -51,8 +51,7 @@ #undef SUBSUBTARGET_EXTRA_SPECS #define SUBSUBTARGET_EXTRA_SPECS -#ifndef ASM_SPEC -#define ASM_SPEC "\ +#define DEFAULT_ASM_SPEC "\ %{mbig-endian:-EB} \ %{mlittle-endian:-EL} \ %(asm_cpu_spec) \ @@ -61,6 +60,9 @@ %{mthumb-interwork:-mthumb-interwork} \ %{mfloat-abi=*} %{mfpu=*} \ %(subtarget_extra_asm_spec)" + +#ifndef ASM_SPEC +#define ASM_SPEC DEFAULT_ASM_SPEC #endif /* The ARM uses @ are a comment character so we need to redefine diff --git a/gcc-4.8/gcc/config/arm/linux-eabi.h b/gcc-4.8/gcc/config/arm/linux-eabi.h index 4a425c872..a320c36ca 100644 --- a/gcc-4.8/gcc/config/arm/linux-eabi.h +++ b/gcc-4.8/gcc/config/arm/linux-eabi.h @@ -92,6 +92,11 @@ #define CC1PLUS_SPEC \ LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) +#undef ASM_SPEC +#define ASM_SPEC \ + LINUX_OR_ANDROID_CC (DEFAULT_ASM_SPEC, \ + DEFAULT_ASM_SPEC " " ANDROID_ASM_SPEC) + #undef LIB_SPEC #define LIB_SPEC \ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \ diff --git a/gcc-4.8/gcc/config/i386/gnu-user.h b/gcc-4.8/gcc/config/i386/gnu-user.h index c93d9757d..2f0a4d74a 100644 --- a/gcc-4.8/gcc/config/i386/gnu-user.h +++ b/gcc-4.8/gcc/config/i386/gnu-user.h @@ -67,7 +67,8 @@ along with GCC; see the file COPYING3. If not see #undef ASM_SPEC #define ASM_SPEC \ - "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" + "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}} " \ + LINUX_OR_ANDROID_CC ("", ANDROID_ASM_SPEC) #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ diff --git a/gcc-4.8/gcc/config/linux-android.h b/gcc-4.8/gcc/config/linux-android.h index 2c87c846c..c97b9b765 100644 --- a/gcc-4.8/gcc/config/linux-android.h +++ b/gcc-4.8/gcc/config/linux-android.h @@ -38,7 +38,7 @@ "%{" 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 \ "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} " \ @@ -48,6 +48,9 @@ "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} " \ "%{!frtti:%{!fno-rtti: -fno-rtti}}" +#define ANDROID_ASM_SPEC \ + "--noexecstack" + #define ANDROID_LIB_SPEC \ "%{!static: -ldl}" diff --git a/gcc-4.8/gcc/config/mips/gnu-user.h b/gcc-4.8/gcc/config/mips/gnu-user.h index aa3cc372a..c26a2b5d1 100644 --- a/gcc-4.8/gcc/config/mips/gnu-user.h +++ b/gcc-4.8/gcc/config/mips/gnu-user.h @@ -67,7 +67,8 @@ along with GCC; see the file COPYING3. If not see #undef SUBTARGET_ASM_SPEC #define SUBTARGET_ASM_SPEC \ - "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}" + "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}} " \ + LINUX_OR_ANDROID_CC ("", ANDROID_ASM_SPEC) /* The MIPS assembler has different syntax for .set. We set it to .dummy to trap any errors. */ |