aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.2.1
diff options
context:
space:
mode:
authorDavid Turner <digit@android.com>2010-04-30 09:04:09 -0700
committerAndroid Code Review <code-review@android.com>2010-04-30 09:04:09 -0700
commitf68bf0c483879d30c4d97b9eaf8f9eb558ea1c45 (patch)
treecbe07ea97dce3e9d76b78c63f2a3464ad57a9ec9 /gcc-4.2.1
parentc2511ac51c9e6e6b8cd9900d6159d46718414012 (diff)
parent7bbf60e7d1d437a9b07a900c2e4b5e6a431020b1 (diff)
downloadtoolchain_gcc-f68bf0c483879d30c4d97b9eaf8f9eb558ea1c45.tar.gz
toolchain_gcc-f68bf0c483879d30c4d97b9eaf8f9eb558ea1c45.tar.bz2
toolchain_gcc-f68bf0c483879d30c4d97b9eaf8f9eb558ea1c45.zip
Merge "Add GNU-stack annotation to Android code."
Diffstat (limited to 'gcc-4.2.1')
-rw-r--r--gcc-4.2.1/README.android19
-rw-r--r--gcc-4.2.1/gcc/config/arm/arm.c4
-rw-r--r--gcc-4.2.1/gcc/config/arm/arm.h6
-rw-r--r--gcc-4.2.1/gcc/config/arm/crti.asm5
-rw-r--r--gcc-4.2.1/gcc/config/arm/crtn.asm5
-rw-r--r--gcc-4.2.1/gcc/config/arm/eabi.h3
-rw-r--r--gcc-4.2.1/gcc/config/arm/lib1funcs.asm7
-rw-r--r--gcc-4.2.1/gcc/config/arm/libunwind.S6
-rw-r--r--gcc-4.2.1/gcc/config/arm/linux-elf.h4
9 files changed, 59 insertions, 0 deletions
diff --git a/gcc-4.2.1/README.android b/gcc-4.2.1/README.android
index 710653899..ebaa4d75f 100644
--- a/gcc-4.2.1/README.android
+++ b/gcc-4.2.1/README.android
@@ -2,6 +2,25 @@ This is a modified version of gcc-4.2.1 for Android. It is based on a Google
customized gcc-4.2.1. The Google specific changes are documented in
README.google. In addition, this gcc also contains the following changes.
+2010-04-29 Jing Yu <jingyu@google.com>
+
+ Add GNU-stack to generated code to enhance security. Port from
+ http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00119.html
+ and also add a local patch which enforces eabi target to include
+ the GNU-stack annotation.
+
+ Changed Files:
+
+ gcc/config/arm/linux-elf.h
+ gcc/config/arm/arm.c
+ gcc/config/arm/arm.h
+ gcc/config/arm/lib1funcs.asm
+ gcc/config/arm/crti.asm
+ gcc/config/arm/crtn.asm
+ gcc/config/arm/libunwind.S
+ gcc/config/arm/eabi.h
+
+
2009-03-19 Doug Kwan <dougkwan@google.com>
Fix two bugs that caused different code to be generated on Linux
diff --git a/gcc-4.2.1/gcc/config/arm/arm.c b/gcc-4.2.1/gcc/config/arm/arm.c
index aee29b630..ec34cb208 100644
--- a/gcc-4.2.1/gcc/config/arm/arm.c
+++ b/gcc-4.2.1/gcc/config/arm/arm.c
@@ -14468,6 +14468,10 @@ arm_file_end (void)
{
int regno;
+ if (NEED_INDICATE_EXEC_STACK)
+ /* Add .note.GNU-stack. */
+ file_end_indicate_exec_stack ();
+
if (! thumb_call_reg_needed)
return;
diff --git a/gcc-4.2.1/gcc/config/arm/arm.h b/gcc-4.2.1/gcc/config/arm/arm.h
index 784142cfb..d4cb3d686 100644
--- a/gcc-4.2.1/gcc/config/arm/arm.h
+++ b/gcc-4.2.1/gcc/config/arm/arm.h
@@ -2595,4 +2595,10 @@ enum arm_builtins
ARM_BUILTIN_MAX
};
+
+/* Do not emit .note.GNU-stack by default. */
+#ifndef NEED_INDICATE_EXEC_STACK
+#define NEED_INDICATE_EXEC_STACK 0
+#endif
+
#endif /* ! GCC_ARM_H */
diff --git a/gcc-4.2.1/gcc/config/arm/crti.asm b/gcc-4.2.1/gcc/config/arm/crti.asm
index 166a3ce34..abacdd1e3 100644
--- a/gcc-4.2.1/gcc/config/arm/crti.asm
+++ b/gcc-4.2.1/gcc/config/arm/crti.asm
@@ -30,6 +30,11 @@
# This exception does not however invalidate any other reasons why
# the executable file might be covered by the GNU General Public License.
#
+/* An executable stack is *not* required for these functions. */
+#if defined(__ELF__) && defined(__linux__)
+.section .note.GNU-stack,"",%progbits
+.previous
+#endif
# This file just make a stack frame for the contents of the .fini and
# .init sections. Users may put any desired instructions in those
diff --git a/gcc-4.2.1/gcc/config/arm/crtn.asm b/gcc-4.2.1/gcc/config/arm/crtn.asm
index 360afae97..84facb933 100644
--- a/gcc-4.2.1/gcc/config/arm/crtn.asm
+++ b/gcc-4.2.1/gcc/config/arm/crtn.asm
@@ -30,6 +30,11 @@
# This exception does not however invalidate any other reasons why
# the executable file might be covered by the GNU General Public License.
#
+/* An executable stack is *not* required for these functions. */
+#if defined(__ELF__) && defined(__linux__)
+.section .note.GNU-stack,"",%progbits
+.previous
+#endif
# This file just makes sure that the .fini and .init sections do in
# fact return. Users may put any desired instructions in those sections.
diff --git a/gcc-4.2.1/gcc/config/arm/eabi.h b/gcc-4.2.1/gcc/config/arm/eabi.h
index d69598c00..afe81556c 100644
--- a/gcc-4.2.1/gcc/config/arm/eabi.h
+++ b/gcc-4.2.1/gcc/config/arm/eabi.h
@@ -129,3 +129,6 @@
"%{mandroid: %(endfile_android) ;" \
" : %(endfile_default)}"
+/* Add .note.GNU-stack. */
+#undef NEED_INDICATE_EXEC_STACK
+#define NEED_INDICATE_EXEC_STACK 1
diff --git a/gcc-4.2.1/gcc/config/arm/lib1funcs.asm b/gcc-4.2.1/gcc/config/arm/lib1funcs.asm
index 2792b35e3..7e0831ade 100644
--- a/gcc-4.2.1/gcc/config/arm/lib1funcs.asm
+++ b/gcc-4.2.1/gcc/config/arm/lib1funcs.asm
@@ -27,6 +27,13 @@ You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+
+/* An executable stack is *not* required for these functions. */
+#if defined(__ELF__) && defined(__linux__)
+.section .note.GNU-stack,"",%progbits
+.previous
+#endif
+
/* ------------------------------------------------------------------------ */
/* We need to know what prefix to add to function names. */
diff --git a/gcc-4.2.1/gcc/config/arm/libunwind.S b/gcc-4.2.1/gcc/config/arm/libunwind.S
index 81e4236f6..47625e3c1 100644
--- a/gcc-4.2.1/gcc/config/arm/libunwind.S
+++ b/gcc-4.2.1/gcc/config/arm/libunwind.S
@@ -26,6 +26,12 @@
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+/* An executable stack is *not* required for these functions. */
+#if defined(__ELF__) && defined(__linux__)
+.section .note.GNU-stack,"",%progbits
+.previous
+#endif
+
#ifndef __symbian__
#include "lib1funcs.asm"
diff --git a/gcc-4.2.1/gcc/config/arm/linux-elf.h b/gcc-4.2.1/gcc/config/arm/linux-elf.h
index acb13cd01..a746cf541 100644
--- a/gcc-4.2.1/gcc/config/arm/linux-elf.h
+++ b/gcc-4.2.1/gcc/config/arm/linux-elf.h
@@ -104,3 +104,7 @@
/* The GNU/Linux profiler needs a frame pointer. */
#define SUBTARGET_FRAME_POINTER_REQUIRED current_function_profile
+
+/* Add .note.GNU-stack. */
+#undef NEED_INDICATE_EXEC_STACK
+#define NEED_INDICATE_EXEC_STACK 1