#! /bin/sh -e # DP: Add .note.GNU-stack sections for gcc's crt files, libffi and boehm-gc # DP: Taken from FC. dir= if [ $# -eq 3 -a "$2" = '-d' ]; then pdir="-d $3" dir="$3/" elif [ $# -ne 1 ]; then echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" exit 1 fi case "$1" in -patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0 #cd ${dir}gcc && autoconf ;; -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0 #rm ${dir}gcc/configure ;; *) echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" exit 1 esac exit 0 gcc/ 2004-09-20 Jakub Jelinek * 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 * config/ia64/linux.h (TARGET_ASM_FILE_END): Define. boehm-gc/ 2005-02-08 Jakub Jelinek * ia64_save_regs_in_stack.s: Moved to... * ia64_save_regs_in_stack.S: ... this. Add .note.GNU-stack on Linux. libffi/ 2007-05-11 Daniel Jacobowitz * src/arm/sysv.S: Fix ARM comment marker. 2005-02-08 Jakub Jelinek * 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: 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 --- gcc/config/ia64/linux.h.orig 2006-10-12 02:01:00.000000000 +0200 +++ gcc/config/ia64/linux.h 2006-12-11 10:33:13.000000000 +0100 @@ -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*}" --- gcc/config/ia64/lib1funcs.asm.orig 2006-01-18 22:46:41.000000000 +0100 +++ gcc/config/ia64/lib1funcs.asm 2006-12-11 10:33:13.000000000 +0100 @@ -792,3 +792,7 @@ } .endp __floattitf #endif + +#ifdef __linux__ +.section .note.GNU-stack; .previous +#endif --- gcc/config/ia64/crti.asm.orig 2006-01-18 22:46:41.000000000 +0100 +++ gcc/config/ia64/crti.asm 2006-12-11 10:33:13.000000000 +0100 @@ -64,3 +64,7 @@ .body # end of crti.asm + +#ifdef __linux__ +.section .note.GNU-stack; .previous +#endif --- gcc/config/ia64/crtn.asm.orig 2006-01-18 22:46:41.000000000 +0100 +++ gcc/config/ia64/crtn.asm 2006-12-11 10:33:13.000000000 +0100 @@ -54,3 +54,7 @@ br.ret.sptk.many b0 # end of crtn.asm + +#ifdef __linux__ +.section .note.GNU-stack; .previous +#endif --- gcc/config/ia64/crtend.asm.orig 2006-01-18 22:46:41.000000000 +0100 +++ gcc/config/ia64/crtend.asm 2006-12-11 10:33:13.000000000 +0100 @@ -122,3 +122,7 @@ br.ret.sptk.many rp .endp __do_global_ctors_aux + +#ifdef __linux__ +.section .note.GNU-stack; .previous +#endif --- gcc/config/ia64/crtbegin.asm.orig 2006-01-18 22:46:41.000000000 +0100 +++ gcc/config/ia64/crtbegin.asm 2006-12-11 10:33:13.000000000 +0100 @@ -255,3 +255,7 @@ .weak __cxa_finalize #endif .weak _Jv_RegisterClasses + +#ifdef __linux__ +.section .note.GNU-stack; .previous +#endif --- gcc/config/rs6000/ppc-asm.h.orig 2006-01-18 22:46:46.000000000 +0100 +++ gcc/config/rs6000/ppc-asm.h 2006-12-11 10:33:14.000000000 +0100 @@ -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 --- libffi/src/powerpc/ppc_closure.S.orig 2006-03-25 09:16:06.000000000 +0100 +++ libffi/src/powerpc/ppc_closure.S 2006-12-11 10:33:14.000000000 +0100 @@ -281,3 +281,7 @@ .LEFDE1: #endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif --- libffi/src/powerpc/sysv.S.orig 2006-03-25 09:16:06.000000000 +0100 +++ libffi/src/powerpc/sysv.S 2006-12-11 10:33:14.000000000 +0100 @@ -217,3 +217,7 @@ .align 2 .LEFDE1: #endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif --- libffi/src/powerpc/linux64_closure.S.orig 2006-01-18 22:49:27.000000000 +0100 +++ libffi/src/powerpc/linux64_closure.S 2006-12-11 10:33:14.000000000 +0100 @@ -204,3 +204,7 @@ .align 3 .LEFDE1: #endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif --- libffi/src/powerpc/linux64.S.orig 2006-03-25 09:16:06.000000000 +0100 +++ libffi/src/powerpc/linux64.S 2006-12-11 10:33:14.000000000 +0100 @@ -175,3 +175,7 @@ .align 3 .LEFDE1: #endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif --- libffi/src/arm/sysv.S.orig 2006-10-12 02:00:57.000000000 +0200 +++ libffi/src/arm/sysv.S 2006-12-11 10:33:14.000000000 +0100 @@ -255,3 +255,6 @@ .ffi_closure_SYSV_end: .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",%progbits +#endif --- libffi/src/m68k/sysv.S.orig 2006-01-18 22:49:27.000000000 +0100 +++ libffi/src/m68k/sysv.S 2006-12-11 10:33:14.000000000 +0100 @@ -207,3 +207,7 @@ rts CFI_ENDPROC() .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif --- libffi/src/alpha/osf.S.orig 2006-01-18 22:49:27.000000000 +0100 +++ libffi/src/alpha/osf.S 2006-12-11 10:33:14.000000000 +0100 @@ -356,4 +356,8 @@ .byte 16 # uleb128 offset 16*-8 .align 3 $LEFDE3: + +#ifdef __linux__ + .section .note.GNU-stack,"",@progbits +#endif #endif --- libffi/src/x86/sysv.S.orig 2006-01-18 22:49:28.000000000 +0100 +++ libffi/src/x86/sysv.S 2006-12-11 10:33:14.000000000 +0100 @@ -376,3 +376,7 @@ #endif #endif /* ifndef __x86_64__ */ + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif --- libffi/src/x86/unix64.S.orig 2006-01-18 22:49:28.000000000 +0100 +++ libffi/src/x86/unix64.S 2006-12-11 10:33:14.000000000 +0100 @@ -410,3 +410,7 @@ .LEFDE3: #endif /* __x86_64__ */ + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif --- libffi/src/s390/sysv.S.orig 2006-01-18 22:49:28.000000000 +0100 +++ libffi/src/s390/sysv.S 2006-12-11 10:33:14.000000000 +0100 @@ -427,3 +427,6 @@ #endif +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif --- libffi/src/ia64/unix.S.orig 2006-01-18 22:49:29.000000000 +0100 +++ libffi/src/ia64/unix.S 2006-12-11 10:33:14.000000000 +0100 @@ -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 --- libffi/src/sparc/v9.S.orig 2006-01-18 22:49:29.000000000 +0100 +++ libffi/src/sparc/v9.S 2006-12-11 10:33:14.000000000 +0100 @@ -300,3 +300,7 @@ .align 8 .LLEFDE2: #endif + +#ifdef __linux__ + .section .note.GNU-stack,"",@progbits +#endif --- libffi/src/sparc/v8.S.orig 2006-01-18 22:49:29.000000000 +0100 +++ libffi/src/sparc/v8.S 2006-12-11 10:33:14.000000000 +0100 @@ -265,3 +265,7 @@ .byte 0x1f ! uleb128 0x1f .align WS .LLEFDE2: + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif