raco dist: signing repairs for ARM Mac OS
This commit is contained in:
parent
d7e9628caf
commit
cc9fc20a07
|
@ -8,6 +8,7 @@
|
|||
pkg/path
|
||||
setup/main-collects
|
||||
"private/macfw.rkt"
|
||||
"private/mach-o.rkt"
|
||||
"private/windlldir.rkt"
|
||||
"private/elf.rkt"
|
||||
"private/collects-path.rkt"
|
||||
|
@ -132,6 +133,9 @@
|
|||
(build-path collects-dir f)))
|
||||
(directory-list dir)))
|
||||
copy-collects)
|
||||
;; Remove signatures, if any
|
||||
(when (eq? 'macosx (cross-system-type))
|
||||
(for-each remove-signature binaries))
|
||||
;; Patch binaries to find libs
|
||||
(when executables?
|
||||
(patch-binaries binaries types))
|
||||
|
@ -169,6 +173,9 @@
|
|||
exts-dir
|
||||
relative-exts-dir
|
||||
relative->binary-relative)
|
||||
;; Add signatures, if needed
|
||||
(when (eq? 'macosx (cross-system-type))
|
||||
(for-each add-ad-hoc-signature binaries))
|
||||
;; Restore executable permissions:
|
||||
(when old-permss
|
||||
(map done-writable binaries old-permss))
|
||||
|
|
|
@ -290,7 +290,8 @@
|
|||
;; Adjust the number of load commands:
|
||||
(write-ulong (+ total-cnt (if segdata 1 0) (if code-signature-pos -1 0)) out)
|
||||
(write-ulong (+ cmdssz (- code-signature-lc-sz) new-cmd-sz) out)
|
||||
(when segdata
|
||||
(cond
|
||||
[segdata
|
||||
;; Write the new command:
|
||||
(file-position out link-edit-pos)
|
||||
(write-ulong (if link-edit-64? #x19 1) out) ; LC_SEGMENT[_64]
|
||||
|
@ -389,9 +390,20 @@
|
|||
;; Write segdata to former link-data offset:
|
||||
(file-position out out-offset)
|
||||
(display segdata out)
|
||||
(display (make-bytes (- outlen (bytes-length segdata)) 0) out))
|
||||
(display (make-bytes (- outlen (bytes-length segdata)) 0) out)
|
||||
;; Adjust file size
|
||||
(file-truncate out (+ link-edit-offset link-edit-len (- code-signature-size) outlen))
|
||||
(file-truncate out (+ link-edit-offset link-edit-len (- code-signature-size) outlen))]
|
||||
[code-signature-pos
|
||||
;; Shrink linkedit size, since signature is going away
|
||||
(let* ([file-pos (+ link-edit-pos 8 16 (* 1 (if link-edit-64? 8 4)))]
|
||||
[link-edit-len (- linkedit-limit-offset link-edit-offset)]
|
||||
[link-edit-vm-len (round-up-page link-edit-len machine-id)])
|
||||
(file-position out file-pos)
|
||||
((if link-edit-64? write-xulong write-ulong) link-edit-vmlen out)
|
||||
(file-position out (+ file-pos (* 2 (if link-edit-64? 8 4))))
|
||||
((if link-edit-64? write-xulong write-ulong) link-edit-len out)
|
||||
;; Adjust file size
|
||||
(file-truncate out (+ link-edit-offset link-edit-len)))])
|
||||
;; Result is offset where data was written:
|
||||
out-offset))))
|
||||
(lambda ()
|
||||
|
|
Loading…
Reference in New Issue
Block a user