summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asmcomp/asmlibrarian.ml1
-rw-r--r--asmcomp/asmlink.ml4
-rw-r--r--asmcomp/compilenv.ml9
-rw-r--r--asmcomp/compilenv.mli3
-rw-r--r--asmcomp/emit_sparc.mlp12
-rw-r--r--asmcomp/proc_sparc.ml15
6 files changed, 20 insertions, 24 deletions
diff --git a/asmcomp/asmlibrarian.ml b/asmcomp/asmlibrarian.ml
index 7810d06dc4..7a461c8cc8 100644
--- a/asmcomp/asmlibrarian.ml
+++ b/asmcomp/asmlibrarian.ml
@@ -30,6 +30,7 @@ let read_info name =
with Not_found ->
raise(Error(File_not_found name)) in
let (info, crc) = Compilenv.read_unit_info filename in
+ info.ui_force_link <- !Clflags.link_everything;
(* There is no need to keep the approximation in the .cmxa file,
since the compiler will go looking directly for .cmx files.
The linker, which is the only one that reads .cmxa files, does not
diff --git a/asmcomp/asmlink.ml b/asmcomp/asmlink.ml
index 1a2efae109..b6c0abda55 100644
--- a/asmcomp/asmlink.ml
+++ b/asmcomp/asmlink.ml
@@ -108,7 +108,9 @@ let scan_file obj_name tolink =
close_in ic;
List.fold_right
(fun (info, crc) reqd ->
- if is_required info.ui_name then begin
+ if info.ui_force_link
+ or !Clflags.link_everything
+ or is_required info.ui_name then begin
check_consistency file_name info crc;
remove_required info.ui_name;
List.iter add_required info.ui_imports_cmx;
diff --git a/asmcomp/compilenv.ml b/asmcomp/compilenv.ml
index f1da4d2c18..45c1414792 100644
--- a/asmcomp/compilenv.ml
+++ b/asmcomp/compilenv.ml
@@ -41,7 +41,8 @@ type unit_infos =
mutable ui_imports_cmx: (string * Digest.t) list; (* Infos imported *)
mutable ui_approx: value_approximation; (* Approx of the structure *)
mutable ui_curry_fun: int list; (* Currying functions needed *)
- mutable ui_apply_fun: int list } (* Apply functions needed *)
+ mutable ui_apply_fun: int list; (* Apply functions needed *)
+ mutable ui_force_link: bool } (* Always linked *)
let global_approx_table =
(Hashtbl.new 17 : (string, value_approximation) Hashtbl.t)
@@ -53,7 +54,8 @@ let current_unit =
ui_imports_cmx = [];
ui_approx = Value_unknown;
ui_curry_fun = [];
- ui_apply_fun = [] }
+ ui_apply_fun = [];
+ ui_force_link = false }
let reset name crc_intf =
Hashtbl.clear global_approx_table;
@@ -62,7 +64,8 @@ let reset name crc_intf =
current_unit.ui_imports_cmi <- [];
current_unit.ui_imports_cmx <- [];
current_unit.ui_curry_fun <- [];
- current_unit.ui_apply_fun <- []
+ current_unit.ui_apply_fun <- [];
+ current_unit.ui_force_link <- false
let current_unit_name () =
current_unit.ui_name
diff --git a/asmcomp/compilenv.mli b/asmcomp/compilenv.mli
index 7dd858d795..6c45497c21 100644
--- a/asmcomp/compilenv.mli
+++ b/asmcomp/compilenv.mli
@@ -22,7 +22,8 @@ type unit_infos =
mutable ui_imports_cmx: (string * Digest.t) list; (* Infos imported *)
mutable ui_approx: value_approximation; (* Approx of the structure *)
mutable ui_curry_fun: int list; (* Currying functions needed *)
- mutable ui_apply_fun: int list } (* Apply functions needed *)
+ mutable ui_apply_fun: int list; (* Apply functions needed *)
+ mutable ui_force_link: bool } (* Always linked *)
val reset: string -> Digest.t -> unit
(* Reset the environment and record the name of the unit being
diff --git a/asmcomp/emit_sparc.mlp b/asmcomp/emit_sparc.mlp
index 67c6a76a9b..bbb9156ebf 100644
--- a/asmcomp/emit_sparc.mlp
+++ b/asmcomp/emit_sparc.mlp
@@ -55,13 +55,10 @@ let next_in_pair = function
| {loc = Reg r; typ = Float} -> phys_reg (r + 15)
| _ -> fatal_error "Emit.next_in_pair"
-(* Symbols are prefixed with _ under SunOS but not under Solaris *)
+(* Symbols are prefixed with _ under SunOS and BSD but not under Solaris *)
let symbol_prefix =
- match Config.system with
- "sunos" -> "_"
- | "solaris" -> ""
- | _ -> fatal_error "wrong $(SYSTEM)"
+ if Config.system = "solaris" then "" else "_"
let emit_symbol s =
if String.length s >= 1 & s.[0] = '.'
@@ -71,10 +68,7 @@ let emit_symbol s =
(* Output a label *)
let label_prefix =
- match Config.system with
- "sunos" -> "L"
- | "solaris" -> ".L"
- | _ -> fatal_error "wrong $(SYSTEM)"
+ if Config.system = "solaris" then ".L" else "L"
let emit_label lbl =
emit_string label_prefix; emit_int lbl
diff --git a/asmcomp/proc_sparc.ml b/asmcomp/proc_sparc.ml
index 0672735dd7..13c70a7863 100644
--- a/asmcomp/proc_sparc.ml
+++ b/asmcomp/proc_sparc.ml
@@ -282,13 +282,8 @@ let assemble_file infile outfile =
let create_archive archive file_list =
Misc.remove_file archive;
- match Config.system with
- "sunos" ->
- Sys.command ("ar rc " ^ archive ^ " " ^ String.concat " " file_list ^
- " && ranlib " ^ archive)
- | "solaris" ->
- Sys.command ("ar rc " ^ archive ^ " " ^ String.concat " " file_list)
- | _ ->
- fatal_error "Proc_sparc.create_archive"
-
-
+ if Config.system = "solaris" then
+ Sys.command ("ar rc " ^ archive ^ " " ^ String.concat " " file_list)
+ else
+ Sys.command ("ar rc " ^ archive ^ " " ^ String.concat " " file_list ^
+ " && ranlib " ^ archive)