Skip to content

Commit

Permalink
flambda-backend: Create object files internally to avoid invoking GAS (
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew4850 authored Aug 3, 2022
1 parent c7a46bb commit f7c2679
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 9 deletions.
57 changes: 51 additions & 6 deletions otherlibs/unix/dune
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
))
(ocamlopt_flags (:include %{project_root}/ocamlopt_flags.sexp))
(library_flags (:standard -linkall))
; UnixLabels is compiled separately as it needs the -nolabels flag. We can't
; currently use an attribute in the .ml file to enable this behaviour as
; the system compiler used to build the boot compiler won't understand it.
(modules (:standard \ unixLabels))
(foreign_stubs (language c) (names
accept access addrofstr alarm bind channels chdir chmod chown chroot close
fsync closedir connect cst2constr cstringv dup dup2 envir errmsg execv execve
Expand All @@ -39,17 +43,58 @@
(:include %{project_root}/oc_cppflags.sexp)))
))

(library
(name unixlabels)
(libraries unix)
(wrapped false)
(modes byte native)
(flags (
-absname -w +a-4-9-41-42-44-45-48 -warn-error A -bin-annot
-g -safe-string -strict-sequence -strict-formats -nolabels
))
(ocamlopt_flags (:include %{project_root}/ocamlopt_flags.sexp))
(modules unixLabels)
)

(rule
(targets unix_merged.a)
(action
(run
%{dep:../../../tools/merge_dot_a_files.sh}
%{targets}
%{dep:unix.a}
%{dep:unixlabels.a})))

(rule
(targets unix_merged.cma)
(action
(run
%{dep:../../../tools/merge_archives.exe}
%{targets}
%{dep:unix.cma}
%{dep:unixlabels.cma})))

(rule
(targets unix_merged.cmxa)
(action
(run
%{dep:../../../tools/merge_archives.exe}
%{targets}
%{dep:unix.cmxa}
%{dep:unixlabels.cmxa})))

(install
(files
.unix.objs/native/unix.cmx
.unix.objs/native/unixLabels.cmx
unix.cmxa
unix.a
unix.cma
.unixlabels.objs/native/unixLabels.cmx
(unix_merged.cmxa as unix.cmxa)
(unix_merged.a as unix.a)
(unix_merged.cma as unix.cma)
.unix.objs/byte/unix.cmi
.unix.objs/byte/unix.cmti
.unix.objs/byte/unixLabels.cmi
.unix.objs/byte/unixLabels.cmti
.unixlabels.objs/byte/unixLabels.cmi
.unixlabels.objs/byte/unixLabels.cmti
; For the moment unix.cmxs does not include UnixLabels.
unix.cmxs
unix.mli
unixLabels.mli
Expand Down
2 changes: 0 additions & 2 deletions otherlibs/unix/unixLabels.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@

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

[@@@ocaml.nolabels]

include Unix
1 change: 0 additions & 1 deletion otherlibs/unix/unixLabels.mli
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

(** {1 Error report} *)


type error = Unix.error =
E2BIG (** Argument list too long *)
| EACCES (** Permission denied *)
Expand Down

0 comments on commit f7c2679

Please sign in to comment.