diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-10-28 13:45:59 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-10-28 15:00:41 +0000 |
commit | 0f6a83529742564e73ffc8cac13d5b159805a2e0 (patch) | |
tree | 81957963a03b91eb74556f5dce9b8ea516a34240 /testing/ocaml/010_all_execstacks.patch | |
parent | 93a756bf967e9d2d014e6266556849bd84cc1cba (diff) | |
download | aports-0f6a83529742564e73ffc8cac13d5b159805a2e0.tar.bz2 aports-0f6a83529742564e73ffc8cac13d5b159805a2e0.tar.xz |
testing/ocaml: add patches from gentoo and fix build on x86
Diffstat (limited to 'testing/ocaml/010_all_execstacks.patch')
-rw-r--r-- | testing/ocaml/010_all_execstacks.patch | 240 |
1 files changed, 240 insertions, 0 deletions
diff --git a/testing/ocaml/010_all_execstacks.patch b/testing/ocaml/010_all_execstacks.patch new file mode 100644 index 0000000000..87e30f4028 --- /dev/null +++ b/testing/ocaml/010_all_execstacks.patch @@ -0,0 +1,240 @@ +Fix the EXEC_STACK in ocaml compiled binaries (#153382) + +Index: ocaml-3.12.0/asmcomp/alpha/emit.mlp +=================================================================== +--- ocaml-3.12.0.orig/asmcomp/alpha/emit.mlp ++++ ocaml-3.12.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.12.0/asmrun/alpha.S +=================================================================== +--- ocaml-3.12.0.orig/asmrun/alpha.S ++++ ocaml-3.12.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.12.0/asmrun/arm.S +=================================================================== +--- ocaml-3.12.0.orig/asmrun/arm.S ++++ ocaml-3.12.0/asmrun/arm.S +@@ -316,3 +316,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.12.0/asmrun/hppa.S +=================================================================== +--- ocaml-3.12.0.orig/asmrun/hppa.S ++++ ocaml-3.12.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.12.0/asmrun/ia64.S +=================================================================== +--- ocaml-3.12.0.orig/asmrun/ia64.S ++++ ocaml-3.12.0/asmrun/ia64.S +@@ -521,3 +521,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.12.0/asmrun/m68k.S +=================================================================== +--- ocaml-3.12.0.orig/asmrun/m68k.S ++++ ocaml-3.12.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.12.0/asmrun/sparc.S +=================================================================== +--- ocaml-3.12.0.orig/asmrun/sparc.S ++++ ocaml-3.12.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.12.0/asmcomp/arm/emit.mlp +=================================================================== +--- ocaml-3.12.0.orig/asmcomp/arm/emit.mlp ++++ ocaml-3.12.0/asmcomp/arm/emit.mlp +@@ -601,6 +601,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() = +@@ -617,6 +624,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.12.0/asmcomp/hppa/emit.mlp +=================================================================== +--- ocaml-3.12.0.orig/asmcomp/hppa/emit.mlp ++++ ocaml-3.12.0/asmcomp/hppa/emit.mlp +@@ -996,6 +996,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() = +@@ -1024,6 +1030,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.12.0/asmcomp/ia64/emit.mlp +=================================================================== +--- ocaml-3.12.0.orig/asmcomp/ia64/emit.mlp ++++ ocaml-3.12.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.12.0/asmcomp/power/emit.mlp +=================================================================== +--- ocaml-3.12.0.orig/asmcomp/power/emit.mlp ++++ ocaml-3.12.0/asmcomp/power/emit.mlp +@@ -927,6 +927,12 @@ let data l = + emit_string data_space; + List.iter emit_item l + ++(* Mark stack as non executable *) ++let nx_stack() = ++ if Config.system = "elf" then ++ ` .section .note.GNU-stack,\"\",%progbits\n` ++ ++ + (* Beginning / end of an assembly file *) + + let begin_assembly() = +@@ -943,6 +949,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.12.0/asmcomp/sparc/emit.mlp +=================================================================== +--- ocaml-3.12.0.orig/asmcomp/sparc/emit.mlp ++++ ocaml-3.12.0/asmcomp/sparc/emit.mlp +@@ -742,6 +742,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() = +@@ -755,6 +761,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`; +Index: ocaml-3.12.0/asmrun/power-elf.S +=================================================================== +--- ocaml-3.12.0.orig/asmrun/power-elf.S ++++ ocaml-3.12.0/asmrun/power-elf.S +@@ -418,3 +418,8 @@ caml_system__frametable: + .long .L105 + 4 /* return address into callback */ + .short -1 /* negative size count => use callback link */ + .short 0 /* no roots here */ ++ ++#ifdef __ELF__ ++.section .note.GNU-stack,"",%progbits ++#endif ++ |