The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Post-bootstrap cleanup

boot/ocamlc now supports everything that the main compiler supports.

+23 -145
-3
.gitignore
··· 252 252 /runtime/build_config.h 253 253 /runtime/sak 254 254 255 - /stdlib/runtime.info 256 255 /stdlib/runtime-launch-info 257 256 /stdlib/labelled-* 258 257 /stdlib/caml 259 258 /stdlib/sys.ml 260 - /stdlib/target_runtime.info 261 - /stdlib/target_runtime-launch-info 262 259 263 260 /testsuite/**/*.result 264 261 /testsuite/**/*.opt_result
-6
Makefile
··· 1896 1896 # in unix.cma and str.cma. This is specified explicitly to suppress the default 1897 1897 # linking flags (see $(MAYBE_ADD_BYTECODE_LAUNCHER_FLAGS) in Makefile.common) 1898 1898 ocamldoc/ocamldoc$(EXE): ocamldoc_BYTECODE_LINKFLAGS += -custom 1899 - else 1900 - ocamldoc/ocamldoc$(EXE): ocamldoc_BYTECODE_LINKFLAGS += $(ROOT_LINK_FLAGS) 1901 1899 endif 1902 1900 1903 1901 .PHONY: ocamldoc ··· 2276 2274 # C stubs in unix.cma. This is specified explicitly to suppress the default 2277 2275 # linking flags (see $(MAYBE_ADD_BYTECODE_LAUNCHER_FLAGS) in Makefile.common) 2278 2276 debugger/ocamldebug$(EXE): ocamldebug_BYTECODE_LINKFLAGS += -custom 2279 - else 2280 - debugger/ocamldebug$(EXE): ocamldebug_BYTECODE_LINKFLAGS += $(ROOT_LINK_FLAGS) 2281 2277 endif 2282 2278 2283 2279 clean:: ··· 2553 2549 # in unix.cma and str.cma. This is specified explicitly to suppress the default 2554 2550 # linking flags (see $(MAYBE_ADD_BYTECODE_LAUNCHER_FLAGS) in Makefile.common) 2555 2551 tools/ocamltex$(EXE): ocamltex_BYTECODE_LINKFLAGS += -custom 2556 - else 2557 - tools/ocamltex$(EXE): ocamltex_BYTECODE_LINKFLAGS += $(ROOT_LINK_FLAGS) 2558 2552 endif 2559 2553 2560 2554 # we need str and unix which depend on the bytecode version of other tools
-37
Makefile.common
··· 347 347 BYTECODE_LAUNCHER_FLAGS = \ 348 348 -launch-method $(call QUOTE_SINGLE,$(LAUNCH_METHOD) $(BINDIR)) 349 349 350 - # Historically, the native Windows ports are assumed to be finding ocamlrun 351 - # using a PATH search. Since boot/ocamlc has no notion of the target, Windows 352 - # requires -runtime-search to be passed explicitly. 353 - ifeq "$(UNIX_OR_WIN32)" "win32" 354 - BYTECODE_LAUNCHER_FLAGS += -runtime-search enable 355 - endif 356 - 357 - # $(BOOTSTRAPPED) will be non-empty after the compiler has been bootstrapped, as 358 - # the -launch-method string will appear in it. 359 - BOOTSTRAPPED := \ 360 - $(shell grep -Fq 'launch-method' $(ROOTDIR)/boot/ocamlc && echo Bootstrapped) 361 - 362 - # Prior to bootstrapping, boot/ocamlc gets the correct host values from 363 - # boot/runtime-launch-info and doesn't yet recognise -launch-method. After 364 - # bootstrapping, both compilers must be passed -launch-method. 365 - ifeq "$(BOOTSTRAPPED)" "" 366 - ROOT_LINK_FLAGS := $(BYTECODE_LAUNCHER_FLAGS) 367 - BYTECODE_LAUNCHER_FLAGS := 368 - endif 369 - 370 - ifeq "$(SUFFIXING)-$(UNIX_OR_WIN32)" "true-win32" 371 - # Historically, the native Windows ports are assumed to be finding ocamlrun 372 - # using a PATH search. -use-runtime ocamlrun-$(ZINC_RUNTIME_ID) won't work here 373 - # as ocamlc will convert it to an absolute path. Instead, we (ab)use 374 - # -runtime-variant to append the -$(ZINC_RUNTIME_ID) to the default ocamlrun. 375 - BYTECODE_LAUNCHER_FLAGS += -runtime-variant -$(ZINC_RUNTIME_ID) 376 - # boot/ocamlc is built with suffixing disabled, so this works both before and 377 - # after bootstrapping, however this would cause $(ROOTDIR)/ocamlc to add the 378 - # suffix twice. Thwart this by further (ab)using -runtime-variant. 379 - ROOT_LINK_FLAGS += -runtime-variant '' 380 - else ifeq "$(SUFFIXING)" "true" 381 - # boot/ocamlc is built with suffixing disabled or not yet bootstrapped, so 382 - # either way pass the suffixed runtime name explicitly with -use-runtime. 383 - BYTECODE_LAUNCHER_FLAGS += \ 384 - -use-runtime $(call QUOTE_SINGLE,$(BINDIR)/ocamlrun-$(ZINC_RUNTIME_ID)) 385 - endif 386 - 387 350 MAYBE_ADD_BYTECODE_LAUNCHER_FLAGS = \ 388 351 $(if $(filter -custom, $(1)),,\ 389 352 -use-prims $(ROOTDIR)/runtime/primitives $(BYTECODE_LAUNCHER_FLAGS))
-3
bytecomp/bytelink.ml
··· 425 425 let zinc_runtime_id, offset = 426 426 if String.length data < 2 then 427 427 raise (Error (Camlheader ("corrupt header", header))) 428 - (* Compatibility with previous header format - remove post-bootstrap *) 429 - else if List.mem data.[0] ['/'; 'e'; 's'] then 430 - None, String.index data '\000' + 2 431 428 else if data.[0] = '\000' then 432 429 None, 1 433 430 else
-8
bytecomp/byterntm.mll
··· 55 55 let dir = dir ^ String.make 1 sep in 56 56 cut_runtime_id (Disable dir) runtime } 57 57 58 - (* Legacy RNTM (remove after bootstrap) *) 59 - | (([^ '\000']* ['/' '\\']) as dir) 60 - ([^ '\\' '/' '\000']+ as runtime) '\000' eof 61 - { if dir = "" then 62 - Some (runtime, None, Enable) 63 - else 64 - Some (runtime, None, Disable dir) } 65 - 66 58 (* Shell script launcher (if it matches, this always matches more than the above 67 59 regexp) *) 68 60 | "#!" [^ ' ' '\n']+ "/sh\n" (("exec '" | "r='") as next)
+8 -26
configure
··· 15356 15356 15357 15357 fi 15358 15358 15359 - # stdlib/runtime.info and stdlib/target_runtime.info are generated by commands 15360 - # in config.status, rather than by the .in mechanism, since the latter cannot 15361 - # reliably process binary files. 15362 - ac_config_commands="$ac_config_commands shebang" 15363 - 15364 - 15365 15359 # Checks for programs 15366 15360 15367 15361 ## Check for the C compiler: done by libtool ··· 24766 24760 exec_prefix="$prefix" 24767 24761 fi 24768 24762 eval "exec_prefix=\"$exec_prefix\"" 24769 - # Set variables necessary to create utils/config.generated.ml and the two 24770 - # runtime-launch-info templates in stdlib. 24771 - # $ocaml_bindir is used for utils/config.generated.ml and is _empty_ if the 24763 + # Set variables necessary to create utils/config.generated.ml. 24764 + # $HOST_BINDIR is always the absolute path to the binary directory, in host 24765 + # format (i.e. potentially with backslashes on Windows). 24766 + # $TARGET_BINDIR can be specified by the caller when building cross-compilers, 24767 + # and the value then is used unaltered. Otherwise, $TARGET_BINDIR is set to 24768 + # '.' when the compiler is configured with --with-relative-libdir or the 24769 + # value of $HOST_BINDIR otherwise. 24770 + # $ocaml_bindir is used in utils/config.generated.ml and is _empty_ if the 24772 24771 # compiler is configured with --with-relative-libdir (otherwise the path 24773 24772 # would be embedded in config.cmo) 24774 - # $HOST_BINDIR and $TARGET_BINDIR are used to generate the two 24775 - # runtime-launch-info files. $HOST_BINDIR is always the absolute path to the 24776 - # binary directory, in host format (i.e. potentially with backslashes on 24777 - # Windows). $TARGET_BINDIR can be specified by the caller when building 24778 - # cross-compilers, and the value then is used unaltered. Otherwise, 24779 - # $TARGET_BINDIR is set to '.' when the compiler is configured with 24780 - # --with-relative-libdir or the value of $HOST_BINDIR otherwise. 24781 24773 eval "HOST_BINDIR=\"$ocaml_bindir\"" 24782 24774 if test "x$bindir_to_libdir" = 'x' 24783 24775 then : ··· 25763 25755 25764 25756 25765 25757 25766 - launch_method='$(echo "$launch_method" | sed -e "s/'/'\"'\"'/g")' 25767 - launch_method_target=\ 25768 - '$(echo "$launch_method_target" | sed -e "s/'/'\"'\"'/g")' 25769 - HOST_BINDIR='$(echo "$HOST_BINDIR" | sed -e "s/'/'\"'\"'/g")' 25770 - TARGET_BINDIR='$(echo "$TARGET_BINDIR" | sed -e "s/'/'\"'\"'/g")' 25771 25758 25772 25759 ocamltest_unix_mod='$ocamltest_unix_mod' 25773 25760 unix_or_win32='$unix_or_win32' ··· 25810 25797 "otherlibs/unix/META") CONFIG_FILES="$CONFIG_FILES otherlibs/unix/META" ;; 25811 25798 "otherlibs/unix/unix.ml") CONFIG_LINKS="$CONFIG_LINKS otherlibs/unix/unix.ml:otherlibs/unix/unix_${unix_or_win32}.ml" ;; 25812 25799 "otherlibs/str/META") CONFIG_FILES="$CONFIG_FILES otherlibs/str/META" ;; 25813 - "shebang") CONFIG_COMMANDS="$CONFIG_COMMANDS shebang" ;; 25814 25800 "otherlibs/systhreads/META") CONFIG_FILES="$CONFIG_FILES otherlibs/systhreads/META" ;; 25815 25801 "links") CONFIG_COMMANDS="$CONFIG_COMMANDS links" ;; 25816 25802 "ocamltest/ocamltest_config.ml") CONFIG_FILES="$CONFIG_FILES ocamltest/ocamltest_config.ml" ;; ··· 26952 26938 chmod +x "$ofile" 26953 26939 26954 26940 ;; 26955 - "shebang":C) printf '%s\n%s\000\n' "$launch_method" "$HOST_BINDIR" \ 26956 - > stdlib/runtime.info 26957 - printf '%s\n%s\000\n' "$launch_method_target" "$TARGET_BINDIR" \ 26958 - > stdlib/target_runtime.info ;; 26959 26941 "runtime/ld.conf":C) rm -f runtime/ld.conf 26960 26942 test x"$ocaml_additional_stublibs_dir" = 'x' || \ 26961 26943 echo "$ocaml_additional_stublibs_dir" > runtime/ld.conf
+8 -28
configure.ac
··· 991 991 )] 992 992 ) 993 993 994 - # stdlib/runtime.info and stdlib/target_runtime.info are generated by commands 995 - # in config.status, rather than by the .in mechanism, since the latter cannot 996 - # reliably process binary files. 997 - AC_CONFIG_COMMANDS([shebang], 998 - [printf '%s\n%s\000\n' "$launch_method" "$HOST_BINDIR" \ 999 - > stdlib/runtime.info 1000 - printf '%s\n%s\000\n' "$launch_method_target" "$TARGET_BINDIR" \ 1001 - > stdlib/target_runtime.info], 1002 - dnl These declarations are put in a here-document in configure, so the command 1003 - dnl in '$(...)' _is_ evaluated as the content is written to config.status (by 1004 - dnl standard interpretation of a here-document). The sed commands quote any 1005 - dnl nefarious single quotes which may appear in any of the strings. 1006 - [launch_method='$(echo "$launch_method" | sed -e "s/'/'\"'\"'/g")' 1007 - launch_method_target=\ 1008 - '$(echo "$launch_method_target" | sed -e "s/'/'\"'\"'/g")' 1009 - HOST_BINDIR='$(echo "$HOST_BINDIR" | sed -e "s/'/'\"'\"'/g")' 1010 - TARGET_BINDIR='$(echo "$TARGET_BINDIR" | sed -e "s/'/'\"'\"'/g")']) 1011 - 1012 994 # Checks for programs 1013 995 1014 996 ## Check for the C compiler: done by libtool ··· 3189 3171 AS_IF([test "x$prefix" = "xNONE"],[prefix="$ac_default_prefix"]) 3190 3172 AS_IF([test "x$exec_prefix" = "xNONE"],[exec_prefix="$prefix"]) 3191 3173 eval "exec_prefix=\"$exec_prefix\"" 3192 - # Set variables necessary to create utils/config.generated.ml and the two 3193 - # runtime-launch-info templates in stdlib. 3194 - # $ocaml_bindir is used for utils/config.generated.ml and is _empty_ if the 3174 + # Set variables necessary to create utils/config.generated.ml. 3175 + # $HOST_BINDIR is always the absolute path to the binary directory, in host 3176 + # format (i.e. potentially with backslashes on Windows). 3177 + # $TARGET_BINDIR can be specified by the caller when building cross-compilers, 3178 + # and the value then is used unaltered. Otherwise, $TARGET_BINDIR is set to 3179 + # '.' when the compiler is configured with --with-relative-libdir or the 3180 + # value of $HOST_BINDIR otherwise. 3181 + # $ocaml_bindir is used in utils/config.generated.ml and is _empty_ if the 3195 3182 # compiler is configured with --with-relative-libdir (otherwise the path 3196 3183 # would be embedded in config.cmo) 3197 - # $HOST_BINDIR and $TARGET_BINDIR are used to generate the two 3198 - # runtime-launch-info files. $HOST_BINDIR is always the absolute path to the 3199 - # binary directory, in host format (i.e. potentially with backslashes on 3200 - # Windows). $TARGET_BINDIR can be specified by the caller when building 3201 - # cross-compilers, and the value then is used unaltered. Otherwise, 3202 - # $TARGET_BINDIR is set to '.' when the compiler is configured with 3203 - # --with-relative-libdir or the value of $HOST_BINDIR otherwise. 3204 3184 eval "HOST_BINDIR=\"$ocaml_bindir\"" 3205 3185 AS_IF([test "x$bindir_to_libdir" = 'x'], 3206 3186 [ocaml_bindir="$HOST_BINDIR"],
+5 -9
stdlib/Makefile
··· 54 54 OTHERS=$(filter-out $(NOSTDLIB),$(OBJS)) 55 55 56 56 .PHONY: all 57 - all: stdlib.cma std_exit.cmo $(HEADER_NAME) target_$(HEADER_NAME) 57 + all: stdlib.cma std_exit.cmo $(HEADER_NAME) 58 58 59 59 .PHONY: allopt opt.opt # allopt and opt.opt are synonyms 60 60 allopt: stdlib.cmxa std_exit.cmx ··· 73 73 *.cmt *.cmti *.mli *.ml *.ml.in \ 74 74 "$(INSTALL_LIBDIR)" 75 75 endif 76 - $(INSTALL_DATA) target_$(HEADER_NAME) "$(INSTALL_LIBDIR)/$(HEADER_NAME)" 76 + $(INSTALL_DATA) $(HEADER_NAME) "$(INSTALL_LIBDIR)/$(HEADER_NAME)" 77 77 78 78 .PHONY: installopt 79 79 installopt: installopt-default ··· 84 84 stdlib.cmxa stdlib.$(A) std_exit.$(O) *.cmx \ 85 85 "$(INSTALL_LIBDIR)" 86 86 87 - runtime-launch-info: runtime.info tmpheader.exe 88 - @{ cat $^; \ 89 - printf '$(if $(filter true,$(SUFFIXING)),$(ZINC_RUNTIME_ID))'; } > $@ 90 - 91 87 MANGLING = $(filter true,$(SUFFIXING)) 92 - target_runtime-launch-info: tmpheader.exe 88 + runtime-launch-info: tmpheader.exe 93 89 @{ printf '$(if $(MANGLING),$(ZINC_RUNTIME_ID_HI),\000)'; \ 94 90 cat $^; } > $@ 95 91 ··· 141 137 142 138 .PHONY: distclean 143 139 distclean: clean 144 - rm -f sys.ml META runtime.info target_runtime.info 140 + rm -f sys.ml META 145 141 146 142 .PHONY: clean 147 143 clean:: 148 - rm -f $(HEADER_NAME) target_$(HEADER_NAME) 144 + rm -f $(HEADER_NAME) 149 145 150 146 export AWK 151 147
-9
stdlib/header.c
··· 349 349 350 350 /* The first character of rntm is NUL for Enable mode */ 351 351 if (*rntm != 0) { 352 - /* boot/ocamlc writes a NUL-terminated string to RNTM. In this case, 353 - rntm_bindir_end points to that NUL (which will have been included in the 354 - length of RNTM recorded in the bytecode image) and immediately following 355 - it is the extra NUL character required by this function. 356 - Interpret this as Disable. For Windows, where the RNTM written by 357 - boot/ocamlc will have just been "ocamlrun\0", this maintains the required 358 - Enable behaviour! This can be removed after a bootstrap. */ 359 - if (rntm_bindir_end + 1 == rntm_end) 360 - rntm_bindir_end++; 361 352 /* For Disable mode, there is no NUL in RNTM, so rntm_bindir_end points to 362 353 the terminator pointed to by rntm_end. For Fallback, there is a NUL in 363 354 the middle of the RNTM "string", which rntm_bindir_end points at. Change
+1 -1
testsuite/tools/cmdline.ml
··· 107 107 has_runtime_search = None; launcher_searches_for_ocamlrun = false; 108 108 target_launcher_searches_for_ocamlrun = false; 109 109 bytecode_shebangs_by_default = false; filename_mangling = false; 110 - libraries = []; zinc_bootstrapped = false} 110 + libraries = []} 111 111 in 112 112 let error fmt = Printf.ksprintf (fun s -> raise (Arg.Bad s)) fmt in 113 113 let check_tree () =
+1 -2
testsuite/tools/harness.ml
··· 37 37 target_launcher_searches_for_ocamlrun: bool; 38 38 bytecode_shebangs_by_default: bool; 39 39 filename_mangling: bool; 40 - libraries: string list list; 41 - zinc_bootstrapped: bool 40 + libraries: string list list 42 41 } 43 42 end 44 43
-4
testsuite/tools/harness.mli
··· 80 80 libraries: string list list; 81 81 (** Sorted list of basenames of libraries to test. 82 82 Derived from {v [$(OTHERLIBRARIES)] v} - {v Makefile.config v} *) 83 - zinc_bootstrapped: bool; 84 - (** True if boot/ocamlc has been bootstrapped (temporary, to allow the 85 - tests to pass on the bootstrap commit before they're updated following 86 - the bootstrap) *) 87 83 } 88 84 end 89 85
-9
testsuite/tools/test_in_prefix.ml
··· 203 203 | _ -> 204 204 Harness.fail_because "Unexpected response from command -v sh" 205 205 in 206 - let config = 207 - let boot_ocamlc = Environment.in_test_root env "../../boot/ocamlc" in 208 - let ocamlrun = Environment.ocamlrun env in 209 - let zinc_bootstrapped = 210 - snd (Environment.run_process env ocamlrun [boot_ocamlc; "-config"]) 211 - |> List.exists (String.starts_with ~prefix:"zinc_runtime_id: ") 212 - in 213 - {config with zinc_bootstrapped} 214 - in 215 206 let run_tests = run_tests ~sh config in 216 207 (* 1. Relocation test *) 217 208 TestRelocation.run ~reproducible config env;