aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2014-04-14 16:27:17 -0700
committerAndrew Hsieh <andrewhsieh@google.com>2014-04-22 15:28:40 -0700
commite9e2116491354ffdf3b216d485fd08d95fc0fc4f (patch)
tree1ba4dddd7b128d7e7fa1fb610f903c1ba4a6343f /gcc-4.9
parent856eafd6efe251c00d0fcc9e60d37ad83032060c (diff)
downloadtoolchain_gcc-e9e2116491354ffdf3b216d485fd08d95fc0fc4f.tar.gz
toolchain_gcc-e9e2116491354ffdf3b216d485fd08d95fc0fc4f.tar.bz2
toolchain_gcc-e9e2116491354ffdf3b216d485fd08d95fc0fc4f.zip
[4.9] Enable assembler linker default for security
See 5c602438be54c0802c21b299ab8bd94efbfc0c70 and 7e66b0108987a56a58c6150672fe7cf8cf88e69a Change-Id: I674ca1da71a1c41024057b66613a875aac97f99a
Diffstat (limited to 'gcc-4.9')
-rw-r--r--gcc-4.9/gcc/config/arm/elf.h6
-rw-r--r--gcc-4.9/gcc/config/arm/linux-eabi.h5
-rw-r--r--gcc-4.9/gcc/config/i386/gnu-user.h3
-rw-r--r--gcc-4.9/gcc/config/linux-android.h5
-rw-r--r--gcc-4.9/gcc/config/mips/gnu-user.h3
5 files changed, 17 insertions, 5 deletions
diff --git a/gcc-4.9/gcc/config/arm/elf.h b/gcc-4.9/gcc/config/arm/elf.h
index 2ac8c8d04..15d53ee99 100644
--- a/gcc-4.9/gcc/config/arm/elf.h
+++ b/gcc-4.9/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.9/gcc/config/arm/linux-eabi.h b/gcc-4.9/gcc/config/arm/linux-eabi.h
index f1f3448f1..c0204b076 100644
--- a/gcc-4.9/gcc/config/arm/linux-eabi.h
+++ b/gcc-4.9/gcc/config/arm/linux-eabi.h
@@ -96,6 +96,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.9/gcc/config/i386/gnu-user.h b/gcc-4.9/gcc/config/i386/gnu-user.h
index e1163c9da..d9e3fa434 100644
--- a/gcc-4.9/gcc/config/i386/gnu-user.h
+++ b/gcc-4.9/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.9/gcc/config/linux-android.h b/gcc-4.9/gcc/config/linux-android.h
index 26f1a74fd..42e061716 100644
--- a/gcc-4.9/gcc/config/linux-android.h
+++ b/gcc-4.9/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.9/gcc/config/mips/gnu-user.h b/gcc-4.9/gcc/config/mips/gnu-user.h
index 638d7f0f5..1a5b0deb9 100644
--- a/gcc-4.9/gcc/config/mips/gnu-user.h
+++ b/gcc-4.9/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. */