Skip to content

Commit f7c2679

Browse files
authored
flambda-backend: Create object files internally to avoid invoking GAS (ocaml-flambda#757)
1 parent c7a46bb commit f7c2679

File tree

3 files changed

+51
-9
lines changed

3 files changed

+51
-9
lines changed

otherlibs/unix/dune

+51-6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
))
2323
(ocamlopt_flags (:include %{project_root}/ocamlopt_flags.sexp))
2424
(library_flags (:standard -linkall))
25+
; UnixLabels is compiled separately as it needs the -nolabels flag. We can't
26+
; currently use an attribute in the .ml file to enable this behaviour as
27+
; the system compiler used to build the boot compiler won't understand it.
28+
(modules (:standard \ unixLabels))
2529
(foreign_stubs (language c) (names
2630
accept access addrofstr alarm bind channels chdir chmod chown chroot close
2731
fsync closedir connect cst2constr cstringv dup dup2 envir errmsg execv execve
@@ -39,17 +43,58 @@
3943
(:include %{project_root}/oc_cppflags.sexp)))
4044
))
4145

46+
(library
47+
(name unixlabels)
48+
(libraries unix)
49+
(wrapped false)
50+
(modes byte native)
51+
(flags (
52+
-absname -w +a-4-9-41-42-44-45-48 -warn-error A -bin-annot
53+
-g -safe-string -strict-sequence -strict-formats -nolabels
54+
))
55+
(ocamlopt_flags (:include %{project_root}/ocamlopt_flags.sexp))
56+
(modules unixLabels)
57+
)
58+
59+
(rule
60+
(targets unix_merged.a)
61+
(action
62+
(run
63+
%{dep:../../../tools/merge_dot_a_files.sh}
64+
%{targets}
65+
%{dep:unix.a}
66+
%{dep:unixlabels.a})))
67+
68+
(rule
69+
(targets unix_merged.cma)
70+
(action
71+
(run
72+
%{dep:../../../tools/merge_archives.exe}
73+
%{targets}
74+
%{dep:unix.cma}
75+
%{dep:unixlabels.cma})))
76+
77+
(rule
78+
(targets unix_merged.cmxa)
79+
(action
80+
(run
81+
%{dep:../../../tools/merge_archives.exe}
82+
%{targets}
83+
%{dep:unix.cmxa}
84+
%{dep:unixlabels.cmxa})))
85+
4286
(install
4387
(files
4488
.unix.objs/native/unix.cmx
45-
.unix.objs/native/unixLabels.cmx
46-
unix.cmxa
47-
unix.a
48-
unix.cma
89+
.unixlabels.objs/native/unixLabels.cmx
90+
(unix_merged.cmxa as unix.cmxa)
91+
(unix_merged.a as unix.a)
92+
(unix_merged.cma as unix.cma)
4993
.unix.objs/byte/unix.cmi
5094
.unix.objs/byte/unix.cmti
51-
.unix.objs/byte/unixLabels.cmi
52-
.unix.objs/byte/unixLabels.cmti
95+
.unixlabels.objs/byte/unixLabels.cmi
96+
.unixlabels.objs/byte/unixLabels.cmti
97+
; For the moment unix.cmxs does not include UnixLabels.
5398
unix.cmxs
5499
unix.mli
55100
unixLabels.mli

otherlibs/unix/unixLabels.ml

-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,4 @@
1515

1616
(* Module [UnixLabels]: labelled Unix module *)
1717

18-
[@@@ocaml.nolabels]
19-
2018
include Unix

otherlibs/unix/unixLabels.mli

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
(** {1 Error report} *)
4242

43-
4443
type error = Unix.error =
4544
E2BIG (** Argument list too long *)
4645
| EACCES (** Permission denied *)

0 commit comments

Comments
 (0)