@@ -211,17 +211,15 @@ let build_package_cmx units unit_names target symbols_to_rename cmxfile =
211
211
map_end (fun s -> target ^ " __" ^ s)
212
212
(List. concat (List. map (fun info -> info.ui_defines) units))
213
213
[target] in
214
+ let approx =
215
+ Compilenv. global_approx (Ident. create_persistent target) in
214
216
let pkg_infos =
215
217
{ ui_name = target;
216
218
ui_defines = defines;
217
219
ui_imports_cmi = (target, Env. crc_of_unit target) ::
218
220
filter(Asmlink. extract_crc_interfaces() );
219
221
ui_imports_cmx = filter(Asmlink. extract_crc_implementations() );
220
- ui_approx =
221
- Value_tuple
222
- (Array. map
223
- (fun info -> rename_approx mapping info.ui_approx)
224
- (Array. of_list units));
222
+ ui_approx = rename_approx mapping approx;
225
223
ui_curry_fun = union(List. map (fun info -> info.ui_curry_fun) units);
226
224
ui_apply_fun = union(List. map (fun info -> info.ui_apply_fun) units);
227
225
ui_force_link = List. exists (fun info -> info.ui_force_link) units
@@ -230,20 +228,16 @@ let build_package_cmx units unit_names target symbols_to_rename cmxfile =
230
228
231
229
(* Make the .o file for the package (not renamed yet) *)
232
230
233
- let make_package_object ppf unit_names objfiles targetobj targetname =
234
- let asmtemp = Filename. temp_file " camlpackage " Config. ext_asm in
231
+ let make_package_object ppf unit_names objfiles
232
+ targetobj targetname coercion =
235
233
let objtemp = Filename. temp_file " camlpackage" Config. ext_obj in
236
- let oc = open_out asmtemp in
237
- Emitaux. output_channel := oc;
238
234
Location. input_name := targetname; (* set the name of the "current" input *)
239
235
Compilenv. reset targetname; (* set the name of the "current" compunit *)
240
- Emit. begin_assembly() ;
241
- List. iter (Asmgen. compile_phrase ppf) (Cmmgen. package unit_names targetname);
242
- Emit. end_assembly() ;
243
- close_out oc;
244
- if Proc. assemble_file asmtemp objtemp <> 0 then
245
- raise(Error (Assembler_error asmtemp));
246
- remove_file asmtemp;
236
+ Asmgen. compile_implementation
237
+ (chop_extension_if_any objtemp) ppf
238
+ (Translmod. transl_store_package
239
+ (List. map Ident. create_persistent unit_names)
240
+ (Ident. create_persistent targetname) coercion);
247
241
let ld_cmd =
248
242
sprintf " %s -o %s %s %s"
249
243
Config. native_partial_linker
@@ -256,13 +250,14 @@ let make_package_object ppf unit_names objfiles targetobj targetname =
256
250
257
251
(* Make the .cmx and the .o for the package *)
258
252
259
- let package_object_files ppf cmxfiles targetcmx targetobj targetname =
253
+ let package_object_files ppf cmxfiles targetcmx
254
+ targetobj targetname coercion =
260
255
let units = map_left_right read_unit_info cmxfiles in
261
256
let unit_names = List. map (fun info -> info.ui_name) units in
262
257
check_units cmxfiles units unit_names;
263
258
let objfiles =
264
259
List. map (fun f -> chop_extension_if_any f ^ Config. ext_obj) cmxfiles in
265
- make_package_object ppf unit_names objfiles targetobj targetname;
260
+ make_package_object ppf unit_names objfiles targetobj targetname coercion ;
266
261
let symbols = rename_in_object_file unit_names targetname targetobj in
267
262
build_package_cmx units unit_names targetname symbols targetcmx
268
263
@@ -282,10 +277,10 @@ let package_files ppf files targetcmx =
282
277
let targetobj = prefix ^ Config. ext_obj in
283
278
let targetname = String. capitalize(Filename. basename prefix) in
284
279
try
285
- Typemod. package_units cmxfiles targetcmi targetname;
286
- package_object_files ppf cmxfiles targetcmx targetobj targetname
280
+ let coercion = Typemod. package_units cmxfiles targetcmi targetname in
281
+ package_object_files ppf cmxfiles targetcmx targetobj targetname coercion
287
282
with x ->
288
- remove_file targetcmi; remove_file targetcmx; remove_file targetobj;
283
+ remove_file targetcmx; remove_file targetobj;
289
284
raise x
290
285
291
286
(* Error report *)
0 commit comments