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/060_all_linkorder.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/060_all_linkorder.patch')
-rw-r--r-- | testing/ocaml/060_all_linkorder.patch | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/ocaml/060_all_linkorder.patch b/testing/ocaml/060_all_linkorder.patch new file mode 100644 index 0000000000..07176b47c6 --- /dev/null +++ b/testing/ocaml/060_all_linkorder.patch @@ -0,0 +1,50 @@ +Always pass the libraries to link as last argument to the linker. +Should fix build failures with as-needed such as: +https://bugs.gentoo.org/show_bug.cgi?id=331075 +https://bugs.gentoo.org/show_bug.cgi?id=331377 + +Index: ocaml-3.12.0/utils/ccomp.ml +=================================================================== +--- ocaml-3.12.0.orig/utils/ccomp.ml ++++ ocaml-3.12.0/utils/ccomp.ml +@@ -98,8 +98,18 @@ type link_mode = + | MainDll + | Partial + ++let is_lib name = String.length name >= 2 && String.sub name 0 2 = "-l" ++ ++let rec link_order init libs = function ++ [] -> List.rev_append init (List.rev libs) ++ | t::q -> if is_lib t then link_order init (t::libs) q else link_order (t::init) libs q ++ ++let rec split_libs libs others = function ++ [] -> (libs, others) ++ | t::q -> if is_lib t then split_libs (t::libs) others q else split_libs libs (t::others) q ++ + let call_linker mode output_name files extra = +- let files = quote_files files in ++ let files = quote_files (link_order [] [] files) in + let cmd = + if mode = Partial then + Printf.sprintf "%s%s %s %s" +@@ -108,7 +118,8 @@ let call_linker mode output_name files e + files + extra + else +- Printf.sprintf "%s -o %s %s %s %s %s %s %s" ++ let (cclibs,ccopts) = split_libs [] [] !Clflags.ccopts in ++ Printf.sprintf "%s -o %s %s %s %s %s %s %s %s" + (match !Clflags.c_compiler, mode with + | Some cc, _ -> cc + | None, Exe -> Config.mkexe +@@ -120,8 +131,9 @@ let call_linker mode output_name files e + (if !Clflags.gprofile then Config.cc_profile else "") + "" (*(Clflags.std_include_flag "-I")*) + (quote_prefixed "-L" !Config.load_path) +- (String.concat " " (List.rev !Clflags.ccopts)) ++ (String.concat " " ccopts) + files ++ (String.concat " " cclibs) + extra + in + command cmd = 0 |