1 diff --git a/gcc-4.4.3/gcc/config/arm/elf.h b/gcc-4.4.3/gcc/config/arm/elf.h 2 index 7c3eddb..018319b 100644 3 --- a/gcc-4.4.3/gcc/config/arm/elf.h 4 +++ b/gcc-4.4.3/gcc/config/arm/elf.h 5 @@ -52,8 +52,7 @@ 6 #undef SUBSUBTARGET_EXTRA_SPECS 7 #define SUBSUBTARGET_EXTRA_SPECS 8 9 -#ifndef ASM_SPEC 10 -#define ASM_SPEC "\ 11 +#define LINUX_ASM_SPEC "\ 12 %{mbig-endian:-EB} \ 13 %{mlittle-endian:-EL} \ 14 %{mcpu=*:-mcpu=%*} \ 15 @@ -64,6 +63,9 @@ 16 %{msoft-float:-mfloat-abi=soft} %{mhard-float:-mfloat-abi=hard} \ 17 %{mfloat-abi=*} %{mfpu=*} \ 18 %(subtarget_extra_asm_spec)" 19 + 20 +#ifndef ASM_SPEC 21 +#define ASM_SPEC LINUX_ASM_SPEC 22 #endif 23 24 /* The ARM uses @ are a comment character so we need to redefine 25 diff --git a/gcc-4.4.3/gcc/config/arm/linux-eabi.h b/gcc-4.4.3/gcc/config/arm/linux-eabi.h 26 index 2ca8818..9bec0c9 100644 27 --- a/gcc-4.4.3/gcc/config/arm/linux-eabi.h 28 +++ b/gcc-4.4.3/gcc/config/arm/linux-eabi.h 29 @@ -79,6 +79,11 @@ 30 #define CC1PLUS_SPEC \ 31 LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) 32 33 +#undef ASM_SPEC 34 +#define ASM_SPEC \ 35 + LINUX_OR_ANDROID_CC (LINUX_ASM_SPEC, \ 36 + LINUX_ASM_SPEC " " ANDROID_ASM_SPEC) 37 + 38 #undef LIB_SPEC 39 #define LIB_SPEC \ 40 LINUX_OR_ANDROID_LD (LINUX_TARGET_LIB_SPEC, \ 41 diff --git a/gcc-4.4.3/gcc/config/i386/linux.h b/gcc-4.4.3/gcc/config/i386/linux.h 42 index f3a98c2..0d8e806 100644 43 --- a/gcc-4.4.3/gcc/config/i386/linux.h 44 +++ b/gcc-4.4.3/gcc/config/i386/linux.h 45 @@ -129,7 +129,8 @@ along with GCC; see the file COPYING3. If not see 46 #undef ASM_SPEC 47 #define ASM_SPEC \ 48 "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} --32 \ 49 - %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" 50 + %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}} " \ 51 + LINUX_OR_ANDROID_CC ("", ANDROID_ASM_SPEC) 52 53 /* These may be provided by config/linux-grtev2.h. */ 54 #ifndef LINUX_GRTE_EXTRA_SPECS 55 diff --git a/gcc-4.4.3/gcc/config/linux-android.h b/gcc-4.4.3/gcc/config/linux-android.h 56 index 5ca3858..3fe018b 100644 57 --- a/gcc-4.4.3/gcc/config/linux-android.h 58 +++ b/gcc-4.4.3/gcc/config/linux-android.h 59 @@ -39,7 +39,7 @@ 60 "%{" NOANDROID "|tno-android-ld:" LINUX_SPEC ";:" ANDROID_SPEC "}" 61 62 #define ANDROID_LINK_SPEC \ 63 - "%{shared: -Bsymbolic}" 64 + "%{shared: -Bsymbolic} -z noexecstack -z relro -z now" 65 66 #define ANDROID_CC1_SPEC(ANDROID_PIC_DEFAULT) \ 67 "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} " \ 68 @@ -49,6 +49,9 @@ 69 "%{!fexceptions:%{!fno-exceptions: -fexceptions}} " \ 70 "%{!frtti:%{!fno-rtti: -frtti}}" 71 72 +#define ANDROID_ASM_SPEC \ 73 + "--noexecstack" 74 + 75 #define ANDROID_LIB_SPEC \ 76 "%{!static: -ldl}" 77 78 diff --git a/gcc-4.4.3/gcc/config/mips/linux.h b/gcc-4.4.3/gcc/config/mips/linux.h 79 index 0512ef7..7828191 100644 80 --- a/gcc-4.4.3/gcc/config/mips/linux.h 81 +++ b/gcc-4.4.3/gcc/config/mips/linux.h 82 @@ -81,7 +81,8 @@ along with GCC; see the file COPYING3. If not see 83 84 #undef SUBTARGET_ASM_SPEC 85 #define SUBTARGET_ASM_SPEC \ 86 - "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}" 87 + "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}} " \ 88 + LINUX_OR_ANDROID_CC ("", ANDROID_ASM_SPEC) 89 90 /* The MIPS assembler has different syntax for .set. We set it to 91 .dummy to trap any errors. */ 92 diff --git a/gcc-4.6/gcc/config/arm/elf.h b/gcc-4.6/gcc/config/arm/elf.h 93 index 8840088..44d840b 100644 94 --- a/gcc-4.6/gcc/config/arm/elf.h 95 +++ b/gcc-4.6/gcc/config/arm/elf.h 96 @@ -52,8 +52,7 @@ 97 #undef SUBSUBTARGET_EXTRA_SPECS 98 #define SUBSUBTARGET_EXTRA_SPECS 99 100 -#ifndef ASM_SPEC 101 -#define ASM_SPEC "\ 102 +#define LINUX_ASM_SPEC "\ 103 %{mbig-endian:-EB} \ 104 %{mlittle-endian:-EL} \ 105 %{mcpu=*:-mcpu=%*} \ 106 @@ -64,6 +63,9 @@ 107 %{msoft-float:-mfloat-abi=soft} %{mhard-float:-mfloat-abi=hard} \ 108 %{mfloat-abi=*} %{mfpu=*} \ 109 %(subtarget_extra_asm_spec)" 110 + 111 +#ifndef ASM_SPEC 112 +#define ASM_SPEC LINUX_ASM_SPEC 113 #endif 114 115 /* The ARM uses @ are a comment character so we need to redefine 116 diff --git a/gcc-4.6/gcc/config/arm/linux-eabi.h b/gcc-4.6/gcc/config/arm/linux-eabi.h 117 index 3a32188..2febcb2 100644 118 --- a/gcc-4.6/gcc/config/arm/linux-eabi.h 119 +++ b/gcc-4.6/gcc/config/arm/linux-eabi.h 120 @@ -79,6 +79,11 @@ 121 #define CC1PLUS_SPEC \ 122 LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) 123 124 +#undef ASM_SPEC 125 +#define ASM_SPEC \ 126 + LINUX_OR_ANDROID_CC (LINUX_ASM_SPEC, \ 127 + LINUX_ASM_SPEC " " ANDROID_ASM_SPEC) 128 + 129 #undef LIB_SPEC 130 #define LIB_SPEC \ 131 LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \ 132 diff --git a/gcc-4.6/gcc/config/i386/linux.h b/gcc-4.6/gcc/config/i386/linux.h 133 index 414dc65..061f5f0 100644 134 --- a/gcc-4.6/gcc/config/i386/linux.h 135 +++ b/gcc-4.6/gcc/config/i386/linux.h 136 @@ -112,7 +112,8 @@ along with GCC; see the file COPYING3. If not see 137 138 #undef ASM_SPEC 139 #define ASM_SPEC \ 140 - "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" 141 + "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}} " \ 142 + LINUX_OR_ANDROID_CC ("", ANDROID_ASM_SPEC) 143 144 /* These may be provided by config/linux-grtev2.h. */ 145 #ifndef LINUX_GRTE_EXTRA_SPECS 146 diff --git a/gcc-4.6/gcc/config/linux-android.h b/gcc-4.6/gcc/config/linux-android.h 147 index acbc662..8234658 100644 148 --- a/gcc-4.6/gcc/config/linux-android.h 149 +++ b/gcc-4.6/gcc/config/linux-android.h 150 @@ -39,7 +39,7 @@ 151 "%{" NOANDROID "|tno-android-ld:" LINUX_SPEC ";:" ANDROID_SPEC "}" 152 153 #define ANDROID_LINK_SPEC \ 154 - "%{shared: -Bsymbolic}" 155 + "%{shared: -Bsymbolic} -z noexecstack -z relro -z now" 156 157 #define ANDROID_CC1_SPEC(ANDROID_PIC_DEFAULT) \ 158 "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} " \ 159 @@ -49,6 +49,9 @@ 160 "%{!fexceptions:%{!fno-exceptions: -fexceptions}} " \ 161 "%{!frtti:%{!fno-rtti: -frtti}}" 162 163 +#define ANDROID_ASM_SPEC \ 164 + "--noexecstack" 165 + 166 #define ANDROID_LIB_SPEC \ 167 "%{!static: -ldl}" 168 169 diff --git a/gcc-4.6/gcc/config/mips/linux.h b/gcc-4.6/gcc/config/mips/linux.h 170 index a78f6bc..d8b1ebe 100644 171 --- a/gcc-4.6/gcc/config/mips/linux.h 172 +++ b/gcc-4.6/gcc/config/mips/linux.h 173 @@ -77,7 +77,8 @@ along with GCC; see the file COPYING3. If not see 174 175 #undef SUBTARGET_ASM_SPEC 176 #define SUBTARGET_ASM_SPEC \ 177 - "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}" 178 + "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}} " \ 179 + LINUX_OR_ANDROID_CC ("", ANDROID_ASM_SPEC) 180 181 /* The MIPS assembler has different syntax for .set. We set it to 182 .dummy to trap any errors. */ 183