···18961896# in unix.cma and str.cma. This is specified explicitly to suppress the default
18971897# linking flags (see $(MAYBE_ADD_BYTECODE_LAUNCHER_FLAGS) in Makefile.common)
18981898ocamldoc/ocamldoc$(EXE): ocamldoc_BYTECODE_LINKFLAGS += -custom
18991899-else
19001900-ocamldoc/ocamldoc$(EXE): ocamldoc_BYTECODE_LINKFLAGS += $(ROOT_LINK_FLAGS)
19011899endif
1902190019031901.PHONY: ocamldoc
···22762274# C stubs in unix.cma. This is specified explicitly to suppress the default
22772275# linking flags (see $(MAYBE_ADD_BYTECODE_LAUNCHER_FLAGS) in Makefile.common)
22782276debugger/ocamldebug$(EXE): ocamldebug_BYTECODE_LINKFLAGS += -custom
22792279-else
22802280-debugger/ocamldebug$(EXE): ocamldebug_BYTECODE_LINKFLAGS += $(ROOT_LINK_FLAGS)
22812277endif
2282227822832279clean::
···25532549# in unix.cma and str.cma. This is specified explicitly to suppress the default
25542550# linking flags (see $(MAYBE_ADD_BYTECODE_LAUNCHER_FLAGS) in Makefile.common)
25552551tools/ocamltex$(EXE): ocamltex_BYTECODE_LINKFLAGS += -custom
25562556-else
25572557-tools/ocamltex$(EXE): ocamltex_BYTECODE_LINKFLAGS += $(ROOT_LINK_FLAGS)
25582552endif
2559255325602554# we need str and unix which depend on the bytecode version of other tools
-37
Makefile.common
···347347BYTECODE_LAUNCHER_FLAGS = \
348348 -launch-method $(call QUOTE_SINGLE,$(LAUNCH_METHOD) $(BINDIR))
349349350350-# Historically, the native Windows ports are assumed to be finding ocamlrun
351351-# using a PATH search. Since boot/ocamlc has no notion of the target, Windows
352352-# requires -runtime-search to be passed explicitly.
353353-ifeq "$(UNIX_OR_WIN32)" "win32"
354354-BYTECODE_LAUNCHER_FLAGS += -runtime-search enable
355355-endif
356356-357357-# $(BOOTSTRAPPED) will be non-empty after the compiler has been bootstrapped, as
358358-# the -launch-method string will appear in it.
359359-BOOTSTRAPPED := \
360360- $(shell grep -Fq 'launch-method' $(ROOTDIR)/boot/ocamlc && echo Bootstrapped)
361361-362362-# Prior to bootstrapping, boot/ocamlc gets the correct host values from
363363-# boot/runtime-launch-info and doesn't yet recognise -launch-method. After
364364-# bootstrapping, both compilers must be passed -launch-method.
365365-ifeq "$(BOOTSTRAPPED)" ""
366366-ROOT_LINK_FLAGS := $(BYTECODE_LAUNCHER_FLAGS)
367367-BYTECODE_LAUNCHER_FLAGS :=
368368-endif
369369-370370-ifeq "$(SUFFIXING)-$(UNIX_OR_WIN32)" "true-win32"
371371-# Historically, the native Windows ports are assumed to be finding ocamlrun
372372-# using a PATH search. -use-runtime ocamlrun-$(ZINC_RUNTIME_ID) won't work here
373373-# as ocamlc will convert it to an absolute path. Instead, we (ab)use
374374-# -runtime-variant to append the -$(ZINC_RUNTIME_ID) to the default ocamlrun.
375375-BYTECODE_LAUNCHER_FLAGS += -runtime-variant -$(ZINC_RUNTIME_ID)
376376-# boot/ocamlc is built with suffixing disabled, so this works both before and
377377-# after bootstrapping, however this would cause $(ROOTDIR)/ocamlc to add the
378378-# suffix twice. Thwart this by further (ab)using -runtime-variant.
379379-ROOT_LINK_FLAGS += -runtime-variant ''
380380-else ifeq "$(SUFFIXING)" "true"
381381-# boot/ocamlc is built with suffixing disabled or not yet bootstrapped, so
382382-# either way pass the suffixed runtime name explicitly with -use-runtime.
383383-BYTECODE_LAUNCHER_FLAGS += \
384384- -use-runtime $(call QUOTE_SINGLE,$(BINDIR)/ocamlrun-$(ZINC_RUNTIME_ID))
385385-endif
386386-387350MAYBE_ADD_BYTECODE_LAUNCHER_FLAGS = \
388351 $(if $(filter -custom, $(1)),,\
389352 -use-prims $(ROOTDIR)/runtime/primitives $(BYTECODE_LAUNCHER_FLAGS))
-3
bytecomp/bytelink.ml
···425425 let zinc_runtime_id, offset =
426426 if String.length data < 2 then
427427 raise (Error (Camlheader ("corrupt header", header)))
428428- (* Compatibility with previous header format - remove post-bootstrap *)
429429- else if List.mem data.[0] ['/'; 'e'; 's'] then
430430- None, String.index data '\000' + 2
431428 else if data.[0] = '\000' then
432429 None, 1
433430 else
-8
bytecomp/byterntm.mll
···5555 let dir = dir ^ String.make 1 sep in
5656 cut_runtime_id (Disable dir) runtime }
57575858-(* Legacy RNTM (remove after bootstrap) *)
5959- | (([^ '\000']* ['/' '\\']) as dir)
6060- ([^ '\\' '/' '\000']+ as runtime) '\000' eof
6161- { if dir = "" then
6262- Some (runtime, None, Enable)
6363- else
6464- Some (runtime, None, Disable dir) }
6565-6658(* Shell script launcher (if it matches, this always matches more than the above
6759 regexp) *)
6860 | "#!" [^ ' ' '\n']+ "/sh\n" (("exec '" | "r='") as next)
+8-26
configure
···15356153561535715357fi
15358153581535915359-# stdlib/runtime.info and stdlib/target_runtime.info are generated by commands
1536015360-# in config.status, rather than by the .in mechanism, since the latter cannot
1536115361-# reliably process binary files.
1536215362-ac_config_commands="$ac_config_commands shebang"
1536315363-1536415364-1536515359# Checks for programs
15366153601536715361## Check for the C compiler: done by libtool
···2476624760 exec_prefix="$prefix"
2476724761fi
2476824762 eval "exec_prefix=\"$exec_prefix\""
2476924769- # Set variables necessary to create utils/config.generated.ml and the two
2477024770- # runtime-launch-info templates in stdlib.
2477124771- # $ocaml_bindir is used for utils/config.generated.ml and is _empty_ if the
2476324763+ # Set variables necessary to create utils/config.generated.ml.
2476424764+ # $HOST_BINDIR is always the absolute path to the binary directory, in host
2476524765+ # format (i.e. potentially with backslashes on Windows).
2476624766+ # $TARGET_BINDIR can be specified by the caller when building cross-compilers,
2476724767+ # and the value then is used unaltered. Otherwise, $TARGET_BINDIR is set to
2476824768+ # '.' when the compiler is configured with --with-relative-libdir or the
2476924769+ # value of $HOST_BINDIR otherwise.
2477024770+ # $ocaml_bindir is used in utils/config.generated.ml and is _empty_ if the
2477224771 # compiler is configured with --with-relative-libdir (otherwise the path
2477324772 # would be embedded in config.cmo)
2477424774- # $HOST_BINDIR and $TARGET_BINDIR are used to generate the two
2477524775- # runtime-launch-info files. $HOST_BINDIR is always the absolute path to the
2477624776- # binary directory, in host format (i.e. potentially with backslashes on
2477724777- # Windows). $TARGET_BINDIR can be specified by the caller when building
2477824778- # cross-compilers, and the value then is used unaltered. Otherwise,
2477924779- # $TARGET_BINDIR is set to '.' when the compiler is configured with
2478024780- # --with-relative-libdir or the value of $HOST_BINDIR otherwise.
2478124773 eval "HOST_BINDIR=\"$ocaml_bindir\""
2478224774 if test "x$bindir_to_libdir" = 'x'
2478324775then :
···2576325755257642575625765257572576625766- launch_method='$(echo "$launch_method" | sed -e "s/'/'\"'\"'/g")'
2576725767- launch_method_target=\
2576825768-'$(echo "$launch_method_target" | sed -e "s/'/'\"'\"'/g")'
2576925769- HOST_BINDIR='$(echo "$HOST_BINDIR" | sed -e "s/'/'\"'\"'/g")'
2577025770- TARGET_BINDIR='$(echo "$TARGET_BINDIR" | sed -e "s/'/'\"'\"'/g")'
25771257582577225759 ocamltest_unix_mod='$ocamltest_unix_mod'
2577325760 unix_or_win32='$unix_or_win32'
···2581025797 "otherlibs/unix/META") CONFIG_FILES="$CONFIG_FILES otherlibs/unix/META" ;;
2581125798 "otherlibs/unix/unix.ml") CONFIG_LINKS="$CONFIG_LINKS otherlibs/unix/unix.ml:otherlibs/unix/unix_${unix_or_win32}.ml" ;;
2581225799 "otherlibs/str/META") CONFIG_FILES="$CONFIG_FILES otherlibs/str/META" ;;
2581325813- "shebang") CONFIG_COMMANDS="$CONFIG_COMMANDS shebang" ;;
2581425800 "otherlibs/systhreads/META") CONFIG_FILES="$CONFIG_FILES otherlibs/systhreads/META" ;;
2581525801 "links") CONFIG_COMMANDS="$CONFIG_COMMANDS links" ;;
2581625802 "ocamltest/ocamltest_config.ml") CONFIG_FILES="$CONFIG_FILES ocamltest/ocamltest_config.ml" ;;
···2695226938 chmod +x "$ofile"
26953269392695426940 ;;
2695526955- "shebang":C) printf '%s\n%s\000\n' "$launch_method" "$HOST_BINDIR" \
2695626956- > stdlib/runtime.info
2695726957- printf '%s\n%s\000\n' "$launch_method_target" "$TARGET_BINDIR" \
2695826958- > stdlib/target_runtime.info ;;
2695926941 "runtime/ld.conf":C) rm -f runtime/ld.conf
2696026942 test x"$ocaml_additional_stublibs_dir" = 'x' || \
2696126943 echo "$ocaml_additional_stublibs_dir" > runtime/ld.conf
+8-28
configure.ac
···991991 )]
992992)
993993994994-# stdlib/runtime.info and stdlib/target_runtime.info are generated by commands
995995-# in config.status, rather than by the .in mechanism, since the latter cannot
996996-# reliably process binary files.
997997-AC_CONFIG_COMMANDS([shebang],
998998- [printf '%s\n%s\000\n' "$launch_method" "$HOST_BINDIR" \
999999- > stdlib/runtime.info
10001000- printf '%s\n%s\000\n' "$launch_method_target" "$TARGET_BINDIR" \
10011001- > stdlib/target_runtime.info],
10021002-dnl These declarations are put in a here-document in configure, so the command
10031003-dnl in '$(...)' _is_ evaluated as the content is written to config.status (by
10041004-dnl standard interpretation of a here-document). The sed commands quote any
10051005-dnl nefarious single quotes which may appear in any of the strings.
10061006- [launch_method='$(echo "$launch_method" | sed -e "s/'/'\"'\"'/g")'
10071007- launch_method_target=\
10081008-'$(echo "$launch_method_target" | sed -e "s/'/'\"'\"'/g")'
10091009- HOST_BINDIR='$(echo "$HOST_BINDIR" | sed -e "s/'/'\"'\"'/g")'
10101010- TARGET_BINDIR='$(echo "$TARGET_BINDIR" | sed -e "s/'/'\"'\"'/g")'])
10111011-1012994# Checks for programs
10139951014996## Check for the C compiler: done by libtool
···31893171 AS_IF([test "x$prefix" = "xNONE"],[prefix="$ac_default_prefix"])
31903172 AS_IF([test "x$exec_prefix" = "xNONE"],[exec_prefix="$prefix"])
31913173 eval "exec_prefix=\"$exec_prefix\""
31923192- # Set variables necessary to create utils/config.generated.ml and the two
31933193- # runtime-launch-info templates in stdlib.
31943194- # $ocaml_bindir is used for utils/config.generated.ml and is _empty_ if the
31743174+ # Set variables necessary to create utils/config.generated.ml.
31753175+ # $HOST_BINDIR is always the absolute path to the binary directory, in host
31763176+ # format (i.e. potentially with backslashes on Windows).
31773177+ # $TARGET_BINDIR can be specified by the caller when building cross-compilers,
31783178+ # and the value then is used unaltered. Otherwise, $TARGET_BINDIR is set to
31793179+ # '.' when the compiler is configured with --with-relative-libdir or the
31803180+ # value of $HOST_BINDIR otherwise.
31813181+ # $ocaml_bindir is used in utils/config.generated.ml and is _empty_ if the
31953182 # compiler is configured with --with-relative-libdir (otherwise the path
31963183 # would be embedded in config.cmo)
31973197- # $HOST_BINDIR and $TARGET_BINDIR are used to generate the two
31983198- # runtime-launch-info files. $HOST_BINDIR is always the absolute path to the
31993199- # binary directory, in host format (i.e. potentially with backslashes on
32003200- # Windows). $TARGET_BINDIR can be specified by the caller when building
32013201- # cross-compilers, and the value then is used unaltered. Otherwise,
32023202- # $TARGET_BINDIR is set to '.' when the compiler is configured with
32033203- # --with-relative-libdir or the value of $HOST_BINDIR otherwise.
32043184 eval "HOST_BINDIR=\"$ocaml_bindir\""
32053185 AS_IF([test "x$bindir_to_libdir" = 'x'],
32063186 [ocaml_bindir="$HOST_BINDIR"],
···349349350350 /* The first character of rntm is NUL for Enable mode */
351351 if (*rntm != 0) {
352352- /* boot/ocamlc writes a NUL-terminated string to RNTM. In this case,
353353- rntm_bindir_end points to that NUL (which will have been included in the
354354- length of RNTM recorded in the bytecode image) and immediately following
355355- it is the extra NUL character required by this function.
356356- Interpret this as Disable. For Windows, where the RNTM written by
357357- boot/ocamlc will have just been "ocamlrun\0", this maintains the required
358358- Enable behaviour! This can be removed after a bootstrap. */
359359- if (rntm_bindir_end + 1 == rntm_end)
360360- rntm_bindir_end++;
361352 /* For Disable mode, there is no NUL in RNTM, so rntm_bindir_end points to
362353 the terminator pointed to by rntm_end. For Fallback, there is a NUL in
363354 the middle of the RNTM "string", which rntm_bindir_end points at. Change
+1-1
testsuite/tools/cmdline.ml
···107107 has_runtime_search = None; launcher_searches_for_ocamlrun = false;
108108 target_launcher_searches_for_ocamlrun = false;
109109 bytecode_shebangs_by_default = false; filename_mangling = false;
110110- libraries = []; zinc_bootstrapped = false}
110110+ libraries = []}
111111 in
112112 let error fmt = Printf.ksprintf (fun s -> raise (Arg.Bad s)) fmt in
113113 let check_tree () =
+1-2
testsuite/tools/harness.ml
···3737 target_launcher_searches_for_ocamlrun: bool;
3838 bytecode_shebangs_by_default: bool;
3939 filename_mangling: bool;
4040- libraries: string list list;
4141- zinc_bootstrapped: bool
4040+ libraries: string list list
4241 }
4342end
4443
-4
testsuite/tools/harness.mli
···8080 libraries: string list list;
8181 (** Sorted list of basenames of libraries to test.
8282 Derived from {v [$(OTHERLIBRARIES)] v} - {v Makefile.config v} *)
8383- zinc_bootstrapped: bool;
8484- (** True if boot/ocamlc has been bootstrapped (temporary, to allow the
8585- tests to pass on the bootstrap commit before they're updated following
8686- the bootstrap) *)
8783 }
8884end
8985
-9
testsuite/tools/test_in_prefix.ml
···203203 | _ ->
204204 Harness.fail_because "Unexpected response from command -v sh"
205205 in
206206- let config =
207207- let boot_ocamlc = Environment.in_test_root env "../../boot/ocamlc" in
208208- let ocamlrun = Environment.ocamlrun env in
209209- let zinc_bootstrapped =
210210- snd (Environment.run_process env ocamlrun [boot_ocamlc; "-config"])
211211- |> List.exists (String.starts_with ~prefix:"zinc_runtime_id: ")
212212- in
213213- {config with zinc_bootstrapped}
214214- in
215206 let run_tests = run_tests ~sh config in
216207 (* 1. Relocation test *)
217208 TestRelocation.run ~reproducible config env;