diff options
-rw-r--r-- | src/patchsets/ocaml/3.11.1/010_all_execstacks.patch | 239 | ||||
-rw-r--r-- | src/patchsets/ocaml/3.11.1/020_all_configure.patch | 42 | ||||
-rw-r--r-- | src/patchsets/ocaml/3.11.1/030_all_automagic.patch | 54 | ||||
-rw-r--r-- | src/patchsets/ocaml/3.11.1/040_all_yaccldflags.patch | 17 | ||||
-rw-r--r-- | src/patchsets/ocaml/3.11.1/series | 4 |
5 files changed, 356 insertions, 0 deletions
diff --git a/src/patchsets/ocaml/3.11.1/010_all_execstacks.patch b/src/patchsets/ocaml/3.11.1/010_all_execstacks.patch new file mode 100644 index 0000000000..a2c4539ed2 --- /dev/null +++ b/src/patchsets/ocaml/3.11.1/010_all_execstacks.patch @@ -0,0 +1,239 @@ +Fix the EXEC_STACK in ocaml compiled binaries (#153382) + +Index: ocaml-3.11.1/asmcomp/alpha/emit.mlp +=================================================================== +--- ocaml-3.11.1.orig/asmcomp/alpha/emit.mlp ++++ ocaml-3.11.1/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.11.1/asmrun/alpha.S +=================================================================== +--- ocaml-3.11.1.orig/asmrun/alpha.S ++++ ocaml-3.11.1/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.11.1/asmrun/arm.S +=================================================================== +--- ocaml-3.11.1.orig/asmrun/arm.S ++++ ocaml-3.11.1/asmrun/arm.S +@@ -342,3 +342,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.11.1/asmrun/hppa.S +=================================================================== +--- ocaml-3.11.1.orig/asmrun/hppa.S ++++ ocaml-3.11.1/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.11.1/asmrun/ia64.S +=================================================================== +--- ocaml-3.11.1.orig/asmrun/ia64.S ++++ ocaml-3.11.1/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.11.1/asmrun/m68k.S +=================================================================== +--- ocaml-3.11.1.orig/asmrun/m68k.S ++++ ocaml-3.11.1/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.11.1/asmrun/power-elf.S +=================================================================== +--- ocaml-3.11.1.orig/asmrun/power-elf.S ++++ ocaml-3.11.1/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.11.1/asmrun/sparc.S +=================================================================== +--- ocaml-3.11.1.orig/asmrun/sparc.S ++++ ocaml-3.11.1/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.11.1/asmcomp/arm/emit.mlp +=================================================================== +--- ocaml-3.11.1.orig/asmcomp/arm/emit.mlp ++++ ocaml-3.11.1/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() = +@@ -658,6 +665,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.11.1/asmcomp/hppa/emit.mlp +=================================================================== +--- ocaml-3.11.1.orig/asmcomp/hppa/emit.mlp ++++ ocaml-3.11.1/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.11.1/asmcomp/ia64/emit.mlp +=================================================================== +--- ocaml-3.11.1.orig/asmcomp/ia64/emit.mlp ++++ ocaml-3.11.1/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.11.1/asmcomp/power/emit.mlp +=================================================================== +--- ocaml-3.11.1.orig/asmcomp/power/emit.mlp ++++ ocaml-3.11.1/asmcomp/power/emit.mlp +@@ -920,6 +920,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() = +@@ -936,6 +942,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.11.1/asmcomp/sparc/emit.mlp +=================================================================== +--- ocaml-3.11.1.orig/asmcomp/sparc/emit.mlp ++++ ocaml-3.11.1/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`; diff --git a/src/patchsets/ocaml/3.11.1/020_all_configure.patch b/src/patchsets/ocaml/3.11.1/020_all_configure.patch new file mode 100644 index 0000000000..59ad1ceeae --- /dev/null +++ b/src/patchsets/ocaml/3.11.1/020_all_configure.patch @@ -0,0 +1,42 @@ +The configure script doesn't inherit previous defined variables, +overwriting previous declarations of bytecccompopts, bytecclinkopts, +nativecccompopts and nativecclinkopts. Reported upstream as issue 0004267. + +Index: ocaml-3.11.1/configure +=================================================================== +--- ocaml-3.11.1.orig/configure ++++ ocaml-3.11.1/configure +@@ -239,7 +239,7 @@ esac + # Configure the bytecode compiler + + bytecc="$cc" +-mkexe="\$(BYTECC)" ++mkexe="\$(BYTECC) \$(BYTECCLINKOPTS)" + bytecccompopts="" + bytecclinkopts="" + dllccompopts="" +@@ -1516,7 +1516,15 @@ fi + + # Final twiddling of compiler options to work around known bugs + ++bytecccompopts="$CFLAGS $bytecccompopts" ++bytecclinkopts="$LDFLAGS $bytecclinkopts" ++natdynlinkopts="$LDFLAGS $natdynlinkopts" ++nativeccrawlinkopts="$RAW_LDFLAGS $nativecclinkopts" ++nativecclinkopts="$LDFLAGS $nativecclinkopts" ++nativecccompopts="$CFLAGS $nativecccompopts" + nativeccprofopts="$nativecccompopts" ++mksharedlib="$mksharedlib $LDFLAGS" ++mkmaindll="$mkmaindll $LDFLAGS" + case "$buggycc" in + gcc.2.96) + bytecccompopts="$bytecccompopts -fomit-frame-pointer" +@@ -1564,7 +1572,7 @@ echo "DEBUGGER=$debugger" >> Makefile + echo "CC_PROFILE=$cc_profile" >> Makefile + echo "SYSTHREAD_SUPPORT=$systhread_support" >> Makefile + echo "PARTIALLD=$partialld" >> Makefile +-echo "PACKLD=\$(PARTIALLD) \$(NATIVECCLINKOPTS) -o " >> Makefile ++echo "PACKLD=\$(PARTIALLD) $nativeccrawlinkopts -o " >> Makefile + echo "DLLCCCOMPOPTS=$dllccompopts" >> Makefile + echo "IFLEXDIR=$iflexdir" >> Makefile + echo "O=o" >> Makefile diff --git a/src/patchsets/ocaml/3.11.1/030_all_automagic.patch b/src/patchsets/ocaml/3.11.1/030_all_automagic.patch new file mode 100644 index 0000000000..d48b769c2f --- /dev/null +++ b/src/patchsets/ocaml/3.11.1/030_all_automagic.patch @@ -0,0 +1,54 @@ +ocaml has automagics on libX11 and gdbm +http://caml.inria.fr/mantis/view.php?id=4278 + +Index: ocaml-3.11.1/configure +=================================================================== +--- ocaml-3.11.1.orig/configure ++++ ocaml-3.11.1/configure +@@ -33,6 +33,8 @@ x11_include_dir='' + x11_lib_dir='' + tk_wanted=yes + pthread_wanted=yes ++graph_wanted=yes ++dbm_wanted=yes + tk_defs='' + tk_libs='' + tk_x11=yes +@@ -93,6 +95,10 @@ while : ; do + ;; # Ignored for backward compatibility + -no-pthread*|--no-pthread*) + pthread_wanted=no;; ++ -no-dbm|--no-dbm) ++ dbm_wanted=no;; ++ -no-graph|--no-graph) ++ graph_wanted=no;; + -no-tk|--no-tk) + tk_wanted=no;; + -tkdefs*|--tkdefs*) +@@ -1318,7 +1324,7 @@ do + done + + +-if test "$x11_include" = "not found" || test "$x11_link" = "not found" ++if test "$x11_include" = "not found" || test "$x11_link" = "not found" || test "$graph_wanted" = "no" + then + echo "X11 not found, the \"graph\" library will not be supported." + x11_include="" +@@ -1366,7 +1372,7 @@ for dir in /usr/include /usr/include/db1 + break + fi + done +-if test "$dbm_include" = "not found" || test "$dbm_link" = "not found"; then ++if test "$dbm_include" = "not found" || test "$dbm_link" = "not found" || test "$dbm_wanted" = "no"; then + echo "NDBM not found, the \"dbm\" library will not be supported." + else + echo "NDBM found (in $dbm_include)" +@@ -1652,7 +1658,7 @@ echo " $otherlibraries" + echo "Configuration for the \"num\" library:" + echo " target architecture ...... $bng_arch (asm level $bng_asm_level)" + +-if test "$x11_include" != "not found" && test "$x11_lib" != "not found"; then ++if test "$x11_include" != "not found" && test "$x11_lib" != "not found" && test "$graph_wanted" != "no"; then + echo "Configuration for the \"graph\" library:" + echo " options for compiling .... $x11_include" + echo " options for linking ...... $x11_link" diff --git a/src/patchsets/ocaml/3.11.1/040_all_yaccldflags.patch b/src/patchsets/ocaml/3.11.1/040_all_yaccldflags.patch new file mode 100644 index 0000000000..8305251768 --- /dev/null +++ b/src/patchsets/ocaml/3.11.1/040_all_yaccldflags.patch @@ -0,0 +1,17 @@ +Respect LDFLAGS for ocamlyacc + +http://caml.inria.fr/mantis/view.php?id=4698 + +Index: ocaml-3.11.1/yacc/Makefile +=================================================================== +--- ocaml-3.11.1.orig/yacc/Makefile ++++ ocaml-3.11.1/yacc/Makefile +@@ -25,7 +25,7 @@ OBJS= closure.o error.o lalr.o lr0.o mai + all: ocamlyacc$(EXE) + + ocamlyacc$(EXE): $(OBJS) +- $(CC) $(CFLAGS) $(CCLINKFLAGS) -o ocamlyacc $(OBJS) ++ $(CC) $(LDFLAGS) $(CFLAGS) $(CCLINKFLAGS) -o ocamlyacc $(OBJS) + + version.h : ../VERSION + echo "#define OCAML_VERSION \"`head -1 ../VERSION`\"" >version.h diff --git a/src/patchsets/ocaml/3.11.1/series b/src/patchsets/ocaml/3.11.1/series new file mode 100644 index 0000000000..95f759189c --- /dev/null +++ b/src/patchsets/ocaml/3.11.1/series @@ -0,0 +1,4 @@ +010_all_execstacks.patch +020_all_configure.patch +030_all_automagic.patch +040_all_yaccldflags.patch |