This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
libffi/boehm-gc/crt files executable stack (missing .note.GNU-stack on .o files)
- From: Matthias Klose <doko at cs dot tu-berlin dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 13 Dec 2006 16:54:11 +0100
- Subject: libffi/boehm-gc/crt files executable stack (missing .note.GNU-stack on .o files)
Add .note.GNU-stack sections for gcc's crt files, libffi and boehm-gc
The patch is taken from the redhat/gcc-4_1-branch, the libffi parts
are reported in PR libffi/28036.
:ADDPATCH libffi:
gcc/
2005-05-04 Jakub Jelinek <jakub@redhat.com>
Revert:
2005-04-29 Alan Modra <amodra@bigpond.net.au>
PR target/21098
* config/rs6000/rs6000.c (rs6000_elf_end_indicate_exec_stack): New.
* config/rs6000/linux64.h (TARGET_ASM_FILE_END): Use the above.
2004-09-20 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/ppc-asm.h: Add .note.GNU-stack section also
on ppc64-linux.
* config/ia64/lib1funcs.asm: Add .note.GNU-stack section on
ia64-linux.
* config/ia64/crtbegin.asm: Likewise.
* config/ia64/crtend.asm: Likewise.
* config/ia64/crti.asm: Likewise.
* config/ia64/crtn.asm: Likewise.
2004-05-14 Jakub Jelinek <jakub@redhat.com>
* config/ia64/linux.h (TARGET_ASM_FILE_END): Define.
boehm-gc/
2005-02-08 Jakub Jelinek <jakub@redhat.com>
* ia64_save_regs_in_stack.s: Moved to...
* ia64_save_regs_in_stack.S: ... this. Add .note.GNU-stack
on Linux.
libffi/
2005-02-08 Jakub Jelinek <jakub@redhat.com>
PR libffi/28036
* src/alpha/osf.S: Add .note.GNU-stack on Linux.
* src/s390/sysv.S: Likewise.
* src/powerpc/linux64.S: Likewise.
* src/powerpc/linux64_closure.S: Likewise.
* src/powerpc/ppc_closure.S: Likewise.
* src/powerpc/sysv.S: Likewise.
* src/x86/unix64.S: Likewise.
* src/x86/sysv.S: Likewise.
* src/sparc/v8.S: Likewise.
* src/sparc/v9.S: Likewise.
* src/m68k/sysv.S: Likewise.
* src/ia64/unix.S: Likewise.
* src/arm/sysv.S: Likewise.
Index: gcc/config/ia64/linux.h
===================================================================
--- gcc/config/ia64/linux.h (revision 107431)
+++ gcc/config/ia64/linux.h (revision 107432)
@@ -5,6 +5,8 @@
#define TARGET_VERSION fprintf (stderr, " (IA-64) Linux");
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+
/* This is for -profile to use -lc_p instead of -lc. */
#undef CC1_SPEC
#define CC1_SPEC "%{profile:-p} %{G*}"
Index: gcc/config/ia64/lib1funcs.asm
===================================================================
--- gcc/config/ia64/lib1funcs.asm (revision 107431)
+++ gcc/config/ia64/lib1funcs.asm (revision 107432)
@@ -792,3 +792,7 @@
}
.endp __floattitf
#endif
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
Index: gcc/config/ia64/crti.asm
===================================================================
--- gcc/config/ia64/crti.asm (revision 107431)
+++ gcc/config/ia64/crti.asm (revision 107432)
@@ -64,3 +64,7 @@
.body
# end of crti.asm
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
Index: gcc/config/ia64/crtn.asm
===================================================================
--- gcc/config/ia64/crtn.asm (revision 107431)
+++ gcc/config/ia64/crtn.asm (revision 107432)
@@ -54,3 +54,7 @@
br.ret.sptk.many b0
# end of crtn.asm
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
Index: gcc/config/ia64/crtend.asm
===================================================================
--- gcc/config/ia64/crtend.asm (revision 107431)
+++ gcc/config/ia64/crtend.asm (revision 107432)
@@ -122,3 +122,7 @@
br.ret.sptk.many rp
.endp __do_global_ctors_aux
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
Index: gcc/config/ia64/crtbegin.asm
===================================================================
--- gcc/config/ia64/crtbegin.asm (revision 107431)
+++ gcc/config/ia64/crtbegin.asm (revision 107432)
@@ -255,3 +255,7 @@
.weak __cxa_finalize
#endif
.weak _Jv_RegisterClasses
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
Index: gcc/config/rs6000/linux64.h
===================================================================
--- gcc/config/rs6000/linux64.h (revision 107431)
+++ gcc/config/rs6000/linux64.h (revision 107432)
@@ -543,7 +543,7 @@
#undef DRAFT_V4_STRUCT_RET
#define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
-#define TARGET_ASM_FILE_END rs6000_elf_end_indicate_exec_stack
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
#define TARGET_POSIX_IO
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 119819)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -659,7 +659,6 @@
static unsigned int rs6000_elf_section_type_flags (tree, const char *, int);
static void rs6000_elf_asm_out_constructor (rtx, int);
static void rs6000_elf_asm_out_destructor (rtx, int);
-static void rs6000_elf_end_indicate_exec_stack (void) ATTRIBUTE_UNUSED;
static void rs6000_elf_asm_init_sections (void);
static section *rs6000_elf_select_section (tree, int, unsigned HOST_WIDE_INT);
static void rs6000_elf_unique_section (tree, int);
@@ -19332,13 +19331,6 @@
}
ASM_OUTPUT_LABEL (file, name);
}
-
-static void
-rs6000_elf_end_indicate_exec_stack (void)
-{
- if (TARGET_32BIT)
- file_end_indicate_exec_stack ();
-}
#endif
#if TARGET_XCOFF
Index: gcc/config/rs6000/ppc-asm.h
===================================================================
--- gcc/config/rs6000/ppc-asm.h (revision 107431)
+++ gcc/config/rs6000/ppc-asm.h (revision 107432)
@@ -158,7 +158,7 @@
.size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name)
#endif
-#if defined __linux__ && !defined __powerpc64__
+#if defined __linux__
.section .note.GNU-stack
.previous
#endif
Index: boehm-gc/ia64_save_regs_in_stack.s
===================================================================
--- boehm-gc/ia64_save_regs_in_stack.s (revision 107431)
+++ boehm-gc/ia64_save_regs_in_stack.s (revision 107432)
@@ -1,12 +0,0 @@
- .text
- .align 16
- .global GC_save_regs_in_stack
- .proc GC_save_regs_in_stack
-GC_save_regs_in_stack:
- .body
- flushrs
- ;;
- mov r8=ar.bsp
- br.ret.sptk.few rp
- .endp GC_save_regs_in_stack
-
Index: boehm-gc/ia64_save_regs_in_stack.S
===================================================================
--- boehm-gc/ia64_save_regs_in_stack.S (revision 0)
+++ boehm-gc/ia64_save_regs_in_stack.S (revision 107432)
@@ -0,0 +1,15 @@
+ .text
+ .align 16
+ .global GC_save_regs_in_stack
+ .proc GC_save_regs_in_stack
+GC_save_regs_in_stack:
+ .body
+ flushrs
+ ;;
+ mov r8=ar.bsp
+ br.ret.sptk.few rp
+ .endp GC_save_regs_in_stack
+
+#ifdef __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/powerpc/ppc_closure.S
===================================================================
--- libffi/src/powerpc/ppc_closure.S (revision 107431)
+++ libffi/src/powerpc/ppc_closure.S (revision 107432)
@@ -326,3 +326,7 @@
.LEFDE1:
#endif
+
+#if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/powerpc/sysv.S
===================================================================
--- libffi/src/powerpc/sysv.S (revision 107431)
+++ libffi/src/powerpc/sysv.S (revision 107432)
@@ -209,3 +209,7 @@
.align 2
.LEFDE1:
#endif
+
+#if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/powerpc/linux64_closure.S
===================================================================
--- libffi/src/powerpc/linux64_closure.S (revision 107431)
+++ libffi/src/powerpc/linux64_closure.S (revision 107432)
@@ -204,3 +204,7 @@
.align 3
.LEFDE1:
#endif
+
+#if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/powerpc/linux64.S
===================================================================
--- libffi/src/powerpc/linux64.S (revision 107431)
+++ libffi/src/powerpc/linux64.S (revision 107432)
@@ -178,3 +178,7 @@
.align 3
.LEFDE1:
#endif
+
+#if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/arm/sysv.S
===================================================================
--- libffi/src/arm/sysv.S (revision 107431)
+++ libffi/src/arm/sysv.S (revision 107432)
@@ -207,3 +207,6 @@
.ffi_call_SYSV_end:
.size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV)
+#if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/m68k/sysv.S
===================================================================
--- libffi/src/m68k/sysv.S (revision 107431)
+++ libffi/src/m68k/sysv.S (revision 107432)
@@ -95,3 +95,7 @@
unlk %a6
rts
.size ffi_call_SYSV,.-ffi_call_SYSV
+
+#if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/alpha/osf.S
===================================================================
--- libffi/src/alpha/osf.S (revision 107431)
+++ libffi/src/alpha/osf.S (revision 107432)
@@ -356,4 +356,8 @@
.byte 16 # uleb128 offset 16*-8
.align 3
$LEFDE3:
+
+#ifdef __linux__
+ .section .note.GNU-stack,"",@progbits
#endif
+#endif
Index: libffi/src/x86/sysv.S
===================================================================
--- libffi/src/x86/sysv.S (revision 107431)
+++ libffi/src/x86/sysv.S (revision 107432)
@@ -376,3 +376,7 @@
#endif
#endif /* ifndef __x86_64__ */
+
+#if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/x86/unix64.S
===================================================================
--- libffi/src/x86/unix64.S (revision 107431)
+++ libffi/src/x86/unix64.S (revision 107432)
@@ -410,3 +410,7 @@
.LEFDE3:
#endif /* __x86_64__ */
+
+#if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/s390/sysv.S
===================================================================
--- libffi/src/s390/sysv.S (revision 107431)
+++ libffi/src/s390/sysv.S (revision 107432)
@@ -427,3 +427,6 @@
#endif
+#if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/ia64/unix.S
===================================================================
--- libffi/src/ia64/unix.S (revision 107431)
+++ libffi/src/ia64/unix.S (revision 107432)
@@ -553,3 +553,7 @@
data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT
data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE
data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE
+
+#if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/sparc/v9.S
===================================================================
--- libffi/src/sparc/v9.S (revision 107431)
+++ libffi/src/sparc/v9.S (revision 107432)
@@ -300,3 +300,7 @@
.align 8
.LLEFDE2:
#endif
+
+#ifdef __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif
Index: libffi/src/sparc/v8.S
===================================================================
--- libffi/src/sparc/v8.S (revision 107431)
+++ libffi/src/sparc/v8.S (revision 107432)
@@ -265,3 +265,7 @@
.byte 0x1f ! uleb128 0x1f
.align WS
.LLEFDE2:
+
+#if defined __ELF__ && defined __linux__
+ .section .note.GNU-stack,"",@progbits
+#endif