Index: ocaml-3.10.0/asmcomp/alpha/emit.mlp =================================================================== --- ocaml-3.10.0.orig/asmcomp/alpha/emit.mlp +++ ocaml-3.10.0/asmcomp/alpha/emit.mlp @@ -811,6 +811,11 @@ let data l = ` .data\n`; List.iter emit_item l +(* Mark stack as non executable *) +let nx_stack() = + if Config.system = "linux" then + ` .section .note.GNU-stack,\"\",%progbits\n` + (* Beginning / end of an assembly file *) let begin_assembly() = @@ -843,6 +848,7 @@ let begin_assembly() = `{emit_symbol lbl_begin}:\n` let end_assembly () = + nx_stack(); let lbl_end = Compilenv.make_symbol (Some "code_end") in ` .text\n`; ` .globl {emit_symbol lbl_end}\n`; Index: ocaml-3.10.0/asmrun/alpha.S =================================================================== --- ocaml-3.10.0.orig/asmrun/alpha.S +++ ocaml-3.10.0/asmrun/alpha.S @@ -438,3 +438,7 @@ caml_system__frametable: .word -1 /* negative frame size => use callback link */ .word 0 /* no roots here */ .align 3 + +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif Index: ocaml-3.10.0/asmrun/amd64.S =================================================================== --- ocaml-3.10.0.orig/asmrun/amd64.S +++ ocaml-3.10.0/asmrun/amd64.S @@ -366,3 +366,7 @@ caml_negf_mask: .align 16 caml_absf_mask: .quad 0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF + +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif Index: ocaml-3.10.0/asmrun/arm.S =================================================================== --- ocaml-3.10.0.orig/asmrun/arm.S +++ ocaml-3.10.0/asmrun/arm.S @@ -337,3 +337,7 @@ caml_system__frametable: .short -1 /* negative frame size => use callback link */ .short 0 /* no roots */ .align 2 + +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif Index: ocaml-3.10.0/asmrun/hppa.S =================================================================== --- ocaml-3.10.0.orig/asmrun/hppa.S +++ ocaml-3.10.0/asmrun/hppa.S @@ -532,3 +532,8 @@ G(caml_system__frametable): .long L104 + 3 /* return address into callback */ .short -1 /* negative frame size => use callback link */ .short 0 /* no roots */ + +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif + Index: ocaml-3.10.0/asmrun/i386.S =================================================================== --- ocaml-3.10.0.orig/asmrun/i386.S +++ ocaml-3.10.0/asmrun/i386.S @@ -416,3 +416,8 @@ Lmcount$stub: hlt ; hlt ; hlt ; hlt ; hlt .subsections_via_symbols #endif + +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif + Index: ocaml-3.10.0/asmrun/ia64.S =================================================================== --- ocaml-3.10.0.orig/asmrun/ia64.S +++ ocaml-3.10.0/asmrun/ia64.S @@ -528,3 +528,8 @@ caml_system__frametable: .common caml_saved_bsp#, 8, 8 .common caml_saved_rnat#, 8, 8 + +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif + Index: ocaml-3.10.0/asmrun/m68k.S =================================================================== --- ocaml-3.10.0.orig/asmrun/m68k.S +++ ocaml-3.10.0/asmrun/m68k.S @@ -242,3 +242,8 @@ _caml_system__frametable: .long L107 | return address into callback .word -1 | negative frame size => use callback link .word 0 | no roots here + +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif + Index: ocaml-3.10.0/asmrun/power-elf.S =================================================================== --- ocaml-3.10.0.orig/asmrun/power-elf.S +++ ocaml-3.10.0/asmrun/power-elf.S @@ -419,3 +419,7 @@ caml_system__frametable: .short -1 /* negative size count => use callback link */ .short 0 /* no roots here */ +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif + Index: ocaml-3.10.0/asmrun/sparc.S =================================================================== --- ocaml-3.10.0.orig/asmrun/sparc.S +++ ocaml-3.10.0/asmrun/sparc.S @@ -405,3 +405,8 @@ Caml_system__frametable: .type Caml_raise_exception, #function .type Caml_system__frametable, #object #endif + +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif + Index: ocaml-3.10.0/asmcomp/amd64/emit.mlp =================================================================== --- ocaml-3.10.0.orig/asmcomp/amd64/emit.mlp +++ ocaml-3.10.0/asmcomp/amd64/emit.mlp @@ -676,6 +676,13 @@ let data l = ` .data\n`; List.iter emit_item l +(* Mark stack as non executable *) +let nx_stack() = + if Config.system = "linux" then + ` .section .note.GNU-stack,\"\",%progbits\n` + + + (* Beginning / end of an assembly file *) let begin_assembly() = @@ -689,6 +696,7 @@ let begin_assembly() = `{emit_symbol lbl_begin}:\n` let end_assembly() = + nx_stack(); let lbl_end = Compilenv.make_symbol (Some "code_end") in ` .text\n`; ` .globl {emit_symbol lbl_end}\n`; Index: ocaml-3.10.0/asmcomp/arm/emit.mlp =================================================================== --- ocaml-3.10.0.orig/asmcomp/arm/emit.mlp +++ ocaml-3.10.0/asmcomp/arm/emit.mlp @@ -642,6 +642,13 @@ let data l = ` .data\n`; List.iter emit_item l +(* Mark stack as non executable *) +let nx_stack() = + if Config.system = "linux" then + ` .section .note.GNU-stack,\"\",%progbits\n` + + + (* Beginning / end of an assembly file *) let begin_assembly() = @@ -661,6 +668,7 @@ let begin_assembly() = `{emit_symbol lbl_begin}:\n` let end_assembly () = + nx_stack(); let lbl_end = Compilenv.make_symbol (Some "code_end") in ` .text\n`; ` .global {emit_symbol lbl_end}\n`; Index: ocaml-3.10.0/asmcomp/hppa/emit.mlp =================================================================== --- ocaml-3.10.0.orig/asmcomp/hppa/emit.mlp +++ ocaml-3.10.0/asmcomp/hppa/emit.mlp @@ -994,6 +994,12 @@ let data l = ` .data\n`; List.iter emit_item l +(* Mark stack as non executable *) +let nx_stack() = + if Config.system = "linux" then + ` .section .note.GNU-stack,\"\",%progbits\n` + + (* Beginning / end of an assembly file *) let begin_assembly() = @@ -1022,6 +1028,7 @@ let begin_assembly() = let end_assembly() = + nx_stack(); ` .code\n`; let lbl_end = Compilenv.make_symbol (Some "code_end") in declare_global lbl_end; Index: ocaml-3.10.0/asmcomp/i386/emit.mlp =================================================================== --- ocaml-3.10.0.orig/asmcomp/i386/emit.mlp +++ ocaml-3.10.0/asmcomp/i386/emit.mlp @@ -947,6 +947,11 @@ let data l = ` .data\n`; List.iter emit_item l +(* Mark stack as non executable *) +let nx_stack() = + if Config.system = "linux" then + ` .section .note.GNU-stack,\"\",%progbits\n` + (* Beginning / end of an assembly file *) let begin_assembly() = @@ -960,6 +965,7 @@ let begin_assembly() = `{emit_symbol lbl_begin}:\n` let end_assembly() = + nx_stack(); let lbl_end = Compilenv.make_symbol (Some "code_end") in ` .text\n`; ` .globl {emit_symbol lbl_end}\n`; Index: ocaml-3.10.0/asmcomp/ia64/emit.mlp =================================================================== --- ocaml-3.10.0.orig/asmcomp/ia64/emit.mlp +++ ocaml-3.10.0/asmcomp/ia64/emit.mlp @@ -1306,6 +1306,11 @@ let data l = ` .align 8\n`; List.iter emit_item l +(* Mark stack as non executable *) +let nx_stack() = + if Config.system = "linux" then + ` .section .note.GNU-stack,\"\",%progbits\n` + (* Beginning / end of an assembly file *) let begin_assembly() = @@ -1315,6 +1320,7 @@ let begin_assembly() = emit_define_symbol (Compilenv.make_symbol (Some "code_begin")) let end_assembly () = + nx_stack(); ` .data\n`; emit_define_symbol (Compilenv.make_symbol (Some "data_end")); ` .text\n`; Index: ocaml-3.10.0/asmcomp/power/emit.mlp =================================================================== --- ocaml-3.10.0.orig/asmcomp/power/emit.mlp +++ ocaml-3.10.0/asmcomp/power/emit.mlp @@ -916,6 +916,12 @@ let data l = emit_string data_space; List.iter emit_item l +(* Mark stack as non executable *) +let nx_stack() = + if Config.system = "linux" then + ` .section .note.GNU-stack,\"\",%progbits\n` + + (* Beginning / end of an assembly file *) let begin_assembly() = @@ -932,6 +938,7 @@ let begin_assembly() = `{emit_symbol lbl_begin}:\n` let end_assembly() = + nx_stack(); if pic_externals then (* Emit the pointers to external functions *) StringSet.iter emit_external !external_functions; Index: ocaml-3.10.0/asmcomp/sparc/emit.mlp =================================================================== --- ocaml-3.10.0.orig/asmcomp/sparc/emit.mlp +++ ocaml-3.10.0/asmcomp/sparc/emit.mlp @@ -741,6 +741,12 @@ let data l = ` .data\n`; List.iter emit_item l +(* Mark stack as non executable *) +let nx_stack() = + if Config.system = "linux" then + ` .section .note.GNU-stack,\"\",%progbits\n` + + (* Beginning / end of an assembly file *) let begin_assembly() = @@ -754,6 +760,7 @@ let begin_assembly() = `{emit_symbol lbl_begin}:\n` let end_assembly() = + nx_stack(); ` .text\n`; let lbl_end = Compilenv.make_symbol (Some "code_end") in ` .global {emit_symbol lbl_end}\n`;