- (let* ((length (read-word-arg))
- (result (make-string length)))
- (read-string-as-bytes stream result)
- result)))
- ;; Read and validate implementation and version.
- (let* ((implementation (keywordicate (string-from-stream)))
- ;; FIXME: The logic above to read a keyword from the fasl file
- ;; could probably be shared with the read-a-keyword fop.
- (version (read-word-arg)))
- (flet ((check-version (variant
- possible-implementation
- needed-version)
- (when (string= possible-implementation implementation)
- (or (= version needed-version)
- (error 'invalid-fasl-version
- ;; :error :wrong-version
- :stream stream
- :variant variant
- :version version
- :expected needed-version)))))
- (or (check-version "native code"
- +backend-fasl-file-implementation+
- +fasl-file-version+)
- (error 'invalid-fasl-implementation
- :stream stream
- :implementation implementation
- :expected +backend-fasl-file-implementation+))))
- ;; Read and validate *FEATURES* which affect binary compatibility.
- (let ((faff-in-this-file (string-from-stream)))
- (unless (string= faff-in-this-file *features-affecting-fasl-format*)
- (error 'invalid-fasl-features
- :stream stream
- :potential-features *features-potentially-affecting-fasl-format*
- :expected *features-affecting-fasl-format*
- :features faff-in-this-file)))
- ;; success
- t))))
+ (let* ((length (read-unsigned-byte-32-arg))
+ (result (make-string length)))
+ (read-string-as-bytes stream result)
+ result)))
+ ;; Read and validate implementation and version.
+ (let ((implementation (keywordicate (string-from-stream)))
+ (expected-implementation +backend-fasl-file-implementation+))
+ (unless (string= expected-implementation implementation)
+ (error 'invalid-fasl-implementation
+ :stream stream
+ :implementation implementation
+ :expected expected-implementation)))
+ (let* ((fasl-version (read-word-arg))
+ (sbcl-version (if (<= fasl-version 76)
+ "1.0.11.18"
+ (string-from-stream)))
+ (expected-version (sb!xc:lisp-implementation-version)))
+ (unless (string= expected-version sbcl-version)
+ (restart-case
+ (error 'invalid-fasl-version
+ :stream stream
+ :version sbcl-version
+ :expected expected-version)
+ (continue () :report "Load the fasl file anyway"))))
+ ;; Read and validate *FEATURES* which affect binary compatibility.
+ (let ((faff-in-this-file (string-from-stream)))
+ (unless (string= faff-in-this-file *features-affecting-fasl-format*)
+ (error 'invalid-fasl-features
+ :stream stream
+ :potential-features *features-potentially-affecting-fasl-format*
+ :expected *features-affecting-fasl-format*
+ :features faff-in-this-file)))
+ ;; success
+ t))))