From a9ce4e4a70e10377a3033ded9392d67a92a0e2c1 Mon Sep 17 00:00:00 2001 From: Chung-Lin Tang Date: Tue, 20 Jan 2015 14:49:51 +0000 Subject: [PATCH] nios2.c (nios2_asm_file_end): Implement TARGET_ASM_FILE_END hook for adding .note.GNU-stack section when needed. 2015-01-20 Chung-Lin Tang gcc/ * config/nios2/nios2.c (nios2_asm_file_end): Implement TARGET_ASM_FILE_END hook for adding .note.GNU-stack section when needed. (TARGET_ASM_FILE_END): Define. libgcc/ * config/nios2/linux-unwind.h (nios2_fallback_frame_state): Update rt_sigframe format and address for current Nios II Linux conventions. From-SVN: r219898 --- gcc/ChangeLog | 7 +++++++ gcc/config/nios2/nios2.c | 15 +++++++++++++++ libgcc/ChangeLog | 6 ++++++ libgcc/config/nios2/linux-unwind.h | 3 +-- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 995c2e2d22e..68c8f7499c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-01-20 Chung-Lin Tang + + * config/nios2/nios2.c (nios2_asm_file_end): Implement + TARGET_ASM_FILE_END hook for adding .note.GNU-stack section when + needed. + (TARGET_ASM_FILE_END): Define. + 2015-01-20 Maxim Kuvyrkov * config/arm/arm-protos.h (enum arm_sched_autopref): New constants. diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c index 502314942cc..a7a140ee8d6 100644 --- a/gcc/config/nios2/nios2.c +++ b/gcc/config/nios2/nios2.c @@ -2223,6 +2223,18 @@ nios2_output_dwarf_dtprel (FILE *file, int size, rtx x) fprintf (file, ")"); } +/* Implemet TARGET_ASM_FILE_END. */ + +static void +nios2_asm_file_end (void) +{ + /* The Nios II Linux stack is mapped non-executable by default, so add a + .note.GNU-stack section for switching to executable stacks only when + trampolines are generated. */ + if (TARGET_LINUX_ABI && trampolines_created) + file_end_indicate_exec_stack (); +} + /* Implement TARGET_ASM_FUNCTION_PROLOGUE. */ static void nios2_asm_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) @@ -3401,6 +3413,9 @@ nios2_merge_decl_attributes (tree olddecl, tree newdecl) #undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA #define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA nios2_output_addr_const_extra +#undef TARGET_ASM_FILE_END +#define TARGET_ASM_FILE_END nios2_asm_file_end + #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE nios2_option_override diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 84ebcc5c098..e7837d7e9a8 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,9 @@ +2015-01-20 Chung-Lin Tang + + * config/nios2/linux-unwind.h (nios2_fallback_frame_state): + Update rt_sigframe format and address for current Nios II + Linux conventions. + 2015-01-09 Andreas Tobler * config.host (arm*-*-freebsd*): Add new configuration for diff --git a/libgcc/config/nios2/linux-unwind.h b/libgcc/config/nios2/linux-unwind.h index 0f1a405def6..dff1c20076e 100644 --- a/libgcc/config/nios2/linux-unwind.h +++ b/libgcc/config/nios2/linux-unwind.h @@ -67,10 +67,9 @@ nios2_fallback_frame_state (struct _Unwind_Context *context, if (pc[0] == (0x00800004 | (__NR_rt_sigreturn << 6))) { struct rt_sigframe { - char retcode[12]; siginfo_t info; struct nios2_ucontext uc; - } *rt_ = context->ra; + } *rt_ = context->cfa; struct nios2_mcontext *regs = &rt_->uc.uc_mcontext; int i; -- 2.30.2