Better validation of make-array dimensions.
[sbcl.git] / make-host-1.lisp
blob5b765e44856fbde354d58e37add8303fec694208
1 ;;; (We want to have some limit on print length and print level during
2 ;;; bootstrapping because PRINT-OBJECT only gets set up rather late,
3 ;;; and running without PRINT-OBJECT it's easy to fall into printing
4 ;;; enormous (or infinitely circular) low-level representations of
5 ;;; things.)
6 (setf *print-level* 5 *print-length* 5)
8 (progn
9 (load "src/cold/shared.lisp")
10 (load "tools-for-build/ldso-stubs.lisp")
11 (let ((*print-pretty* nil)
12 (*print-length* nil))
13 (dolist (thing '("*SHEBANG-FEATURES*" "*SHEBANG-BACKEND-SUBFEATURES*"))
14 (let ((val (symbol-value (intern thing "SB-COLD"))))
15 (when val
16 (format t "~&target *~A* = ~S~%"
17 (subseq thing (length "*SHEBANG-") (1- (length thing)))
18 val))))))
19 (in-package "SB-COLD")
20 (progn
21 (setf *host-obj-prefix* "obj/from-host/")
22 (load "src/cold/set-up-cold-packages.lisp")
23 (load "src/cold/defun-load-or-cload-xcompiler.lisp")
25 ;; Supress function/macro redefinition warnings under clisp.
26 #+clisp (setf custom:*suppress-check-redefinition* t)
28 (defmacro maybe-with-compilation-unit (&body forms)
29 ;; A compilation-unit seems to kill the compile. I'm not sure if it's
30 ;; running out of memory or what. I don't care to find out,
31 ;; but it's most definitely the cause of the breakage.
32 #+clisp `(progn ,@forms)
34 #+sbcl
35 ;; Watch for deferred warnings under SBCL.
36 ;; UNDEFINED-VARIABLE does not cause COMPILE-FILE to return warnings-p
37 ;; unless outside a compilation unit. You find out about it only upon
38 ;; exit of SUMMARIZE-COMPILATION-UNIT. So we set up a handler for that.
39 `(let (in-summary fail)
40 (handler-bind (((and simple-warning (not style-warning))
41 (lambda (c)
42 ;; hack for PPC. See 'build-order.lisp-expr'
43 ;; Ignore the warning, and the warning about the warning.
44 (unless (or (search "not allowed by the operand type"
45 (simple-condition-format-control c))
46 (search "ignoring FAILURE-P return"
47 (simple-condition-format-control c)))
48 (setq fail 'warning))))
49 ;; Prevent regressions on a couple platforms
50 ;; that are known to build cleanly.
51 #!+(or x86 x86-64 arm64)
52 (sb-int:simple-style-warning
53 (lambda (c)
54 (when (and in-summary
55 (search "undefined"
56 (simple-condition-format-control c)))
57 (unless (eq fail 'warning)
58 (setq fail 'style-warning))))))
59 (with-compilation-unit ()
60 (multiple-value-prog1 (progn ,@forms) (setq in-summary t))))
61 (when fail
62 (cerror "Proceed anyway"
63 "make-host-1 stopped due to unexpected ~A." fail)))
65 #-(or clisp sbcl) `(with-compilation-unit () ,@forms))
67 ;; Now we can set the #[+-] readers to our precautionary
68 ;; readers that prohibit use of ":sbcl" as the condition.
69 (set-dispatch-macro-character #\# #\+ #'she-reader)
70 (set-dispatch-macro-character #\# #\- #'she-reader))
72 (maybe-with-compilation-unit
73 (load-or-cload-xcompiler #'host-cload-stem)
75 ;;; Let's check that the type system, and various other things, are
76 ;;; reasonably sane. (It's easy to spend a long time wandering around
77 ;;; confused trying to debug cross-compilation if it isn't.)
78 (load "tests/type.before-xc.lisp")
79 (load "tests/info.before-xc.lisp")
80 (load "tests/vm.before-xc.lisp")
81 ;; When building on a slow host using a slow Lisp,
82 ;; the wait time in slurp-ucd seems interminable - over a minute.
83 ;; Compiling seems to help a bit, but maybe it's my imagination.
84 (let ((object (compile-file "tools-for-build/ucd.lisp")))
85 (load object)
86 (delete-file object))
88 ;;; Generate character database tables.
89 (dolist (s '(sb-cold::slurp-ucd sb-cold::slurp-proplist sb-cold::output))
90 (funcall s))
92 ;;; propagate structure offset and other information to the C runtime
93 ;;; support code.
94 (host-cload-stem "src/compiler/generic/genesis" nil)
95 ) ; END with-compilation-unit
97 (sb-cold:genesis :c-header-dir-name "src/runtime/genesis")