Make explicit which generated sources are build-dependent

(For example because of different build-time options)
This commit is contained in:
Christophe Rhodes 2022-05-16 11:23:35 +01:00
parent f764e96bad
commit 2dfe932d0a
5 changed files with 16 additions and 11 deletions

View file

@ -14,8 +14,8 @@
(push (stem-object-path stem flags :target-compile)
list)))
(nreverse list))
:defstruct-descriptions (find-bootstrap-file "output/defstructs.lisp-expr")
:tls-init (read-from-file "output/tls-init.lisp-expr")
:defstruct-descriptions (find-bootstrap-file "output/defstructs.lisp-expr" t)
:tls-init (read-from-file "output/tls-init.lisp-expr" :build-dependent t)
:c-header-dir-name "output/genesis-2"
:symbol-table-file-name "src/runtime/sbcl.nm"
:core-file-name "output/cold-sbcl.core"

View file

@ -2571,7 +2571,7 @@ mechanism for inter-thread communication."
(eval-when (:compile-toplevel)
;; Inform genesis of the index <-> symbol mapping made by DEFINE-THREAD-LOCAL
(with-open-file (output (sb-cold:find-bootstrap-file "output/tls-init.lisp-expr")
(with-open-file (output (sb-cold:find-bootstrap-file "output/tls-init.lisp-expr" t)
:direction :output :if-exists :supersede)
(let ((list (mapcar (lambda (x &aux (symbol (car x)))
(cons (info :variable :wired-tls symbol) symbol))

View file

@ -224,4 +224,4 @@
(format t "~&~50t ~f~%" total-time))
(sb-c::dump/restore-interesting-types 'write)))
(sb-kernel::write-structure-definitions-as-text
(sb-cold:find-bootstrap-file "output/defstructs.lisp-expr")))))
(sb-cold:find-bootstrap-file "output/defstructs.lisp-expr" t)))))

View file

@ -169,13 +169,15 @@
(compile 'rename-file-a-la-unix)
(export '(*target-sbcl-version* *generated-sources-root*
*build-dependent-generated-sources-root*
stem-source-path find-bootstrap-file read-from-file))
(defvar *sources-root* "")
(defvar *generated-sources-root* "")
(defvar *build-dependent-generated-sources-root* "")
(defvar *src-cold-shared-pathname* *load-pathname*)
;;; See remark in COMPILE-STEM about strings vs. The Common Lisp Way
(defun find-bootstrap-file (namestring)
(defun find-bootstrap-file (namestring &optional build-dependent)
(cond ((char= (char namestring 0) #\^)
;; If it starts with a "^" then it means "src/cold/..."
(let ((this *src-cold-shared-pathname*)
@ -190,7 +192,9 @@
;; in the tree as checked in, or generated by a prior build step.
(concatenate 'string
(if (eql (mismatch "output/" namestring) 7) ; a generated source
*generated-sources-root*
(if build-dependent
*build-dependent-generated-sources-root*
*generated-sources-root*)
*sources-root*)
namestring))
(t
@ -201,9 +205,10 @@
;;; Return an expression read from the file named NAMESTRING.
;;; For user-supplied inputs, protect against more than one expression
;;; appearing in the file. For in-tree inputs we needn't bother.
(defun read-from-file (namestring &optional (enforce-single-expr t))
(with-open-file (s (find-bootstrap-file namestring))
;;; appearing in the file. (Our ^build-order.lisp-expr file has more than
;;; one expression in it, so we need to be able to not enforce.)
(defun read-from-file (namestring &key (enforce-single-expr t) build-dependent)
(with-open-file (s (find-bootstrap-file namestring build-dependent))
(let* ((result (read s))
(eof-result (cons nil nil)))
(unless enforce-single-expr
@ -505,7 +510,7 @@
;; to produce warnings as a bug workaround.
(let ((cl:*features* (cons feature cl:*features*))
(*readtable* *xc-readtable*))
(read-from-file "^build-order.lisp-expr" nil))))
(read-from-file "^build-order.lisp-expr" :enforce-single-expr nil))))
(setf *stems-and-flags* (cons build-phase list)))
;; Now check for duplicate stems and bogus flags.
(let ((stems (make-hash-table :test 'equal)))

View file

@ -46,7 +46,7 @@
;;; :trace-file as a flag.
(setf *stems-and-flags*
(let ((*readtable* *xc-readtable*))
(read-from-file "^build-order.lisp-expr" nil)))
(read-from-file "^build-order.lisp-expr" :enforce-single-expr nil)))
;;; Don't care about deftransforms that get redefined.
;;; The target condition is defined in 'condition' which is a :not-host file.