From 978e411ffa21a917971b21f1e68003cbe91a5666 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Fri, 3 Nov 2006 00:59:32 +0000 Subject: [PATCH] linux-elf.h (NEED_INDICATE_EXEC_STACK): Define as 1. 2006-11-02 Carlos O'Donell gcc/ * config/arm/linux-elf.h (NEED_INDICATE_EXEC_STACK): Define as 1. * arm.c (arm_file_end): If NEED_INDICATE_EXEC_STACK call file_end_indicate_exec_stack. * arm.h [!NEED_INDICATE_EXEC_STACK] (NEED_INIDCATE_EXEC_STACK): Define as 0. * lib1funcs.asm [__ELF__ && __linux__]: Emit .note.GNU-stack section for a non-executable stack. * crti.asm: Likewise. * crtn.asm: Likewise. * libunwind.S: Likewise. From-SVN: r118445 --- gcc/ChangeLog | 13 +++++++++++++ gcc/config/arm/arm.c | 4 ++++ gcc/config/arm/arm.h | 6 ++++++ gcc/config/arm/crti.asm | 6 ++++++ gcc/config/arm/crtn.asm | 6 ++++++ gcc/config/arm/lib1funcs.asm | 7 +++++++ gcc/config/arm/libunwind.S | 6 ++++++ gcc/config/arm/linux-elf.h | 4 ++++ 8 files changed, 52 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 189604c5c39..db5ad31fa9d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2006-11-02 Carlos O'Donell + + * config/arm/linux-elf.h (NEED_INDICATE_EXEC_STACK): Define as 1. + * arm.c (arm_file_end): If NEED_INDICATE_EXEC_STACK call + file_end_indicate_exec_stack. + * arm.h [!NEED_INDICATE_EXEC_STACK] (NEED_INIDCATE_EXEC_STACK): + Define as 0. + * lib1funcs.asm [__ELF__ && __linux__]: Emit .note.GNU-stack section + for a non-executable stack. + * crti.asm: Likewise. + * crtn.asm: Likewise. + * libunwind.S: Likewise. + 2006-11-02 Ben Elliston * tree-ssa.c (warn_uninit): Use expand_location variables for diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 7c82fcf4036..bbf4863a7ad 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -14417,6 +14417,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/config/arm/arm.h b/gcc/config/arm/arm.h index 26d397726db..beb222263ab 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2591,4 +2591,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/config/arm/crti.asm b/gcc/config/arm/crti.asm index 166a3ce34e8..6f0acd199e0 100644 --- a/gcc/config/arm/crti.asm +++ b/gcc/config/arm/crti.asm @@ -31,6 +31,12 @@ # 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 # sections. diff --git a/gcc/config/arm/crtn.asm b/gcc/config/arm/crtn.asm index 360afae9753..36c417d7dde 100644 --- a/gcc/config/arm/crtn.asm +++ b/gcc/config/arm/crtn.asm @@ -31,6 +31,12 @@ # 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. # This file is the last thing linked into any executable. diff --git a/gcc/config/arm/lib1funcs.asm b/gcc/config/arm/lib1funcs.asm index 9245b3ca0c0..93c0df824a8 100644 --- a/gcc/config/arm/lib1funcs.asm +++ b/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/config/arm/libunwind.S b/gcc/config/arm/libunwind.S index 06e13107d2a..f53a20232b8 100644 --- a/gcc/config/arm/libunwind.S +++ b/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/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h index acb13cd013f..d4e83514206 100644 --- a/gcc/config/arm/linux-elf.h +++ b/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 -- 2.30.2