Mac OS X: fix executable creation for LC_DYLIB_CODE_SIGN_DRS
The LC_DYLIB_CODE_SIGN_DRS load command is relatively new, and
it needs to be updated when we shift __LINKEDIT to add
__PLTSCHEME.
Merge to v6.0
(cherry picked from commit 861384d36d
)
This commit is contained in:
parent
6576fe0341
commit
10ccabce65
|
@ -65,7 +65,9 @@
|
||||||
[data-in-code-offset #f]
|
[data-in-code-offset #f]
|
||||||
[code-signature-pos #f]
|
[code-signature-pos #f]
|
||||||
[code-signature-size 0]
|
[code-signature-size 0]
|
||||||
[code-signature-lc-sz 0])
|
[code-signature-lc-sz 0]
|
||||||
|
[code-sign-drs-pos #f]
|
||||||
|
[code-sign-drs-offset 0])
|
||||||
;; (printf "~a cmds, length 0x~x\n" cnt cmdssz)
|
;; (printf "~a cmds, length 0x~x\n" cnt cmdssz)
|
||||||
(read-ulong p) ; flags
|
(read-ulong p) ; flags
|
||||||
(when (equal? exe-id #xFeedFacf)
|
(when (equal? exe-id #xFeedFacf)
|
||||||
|
@ -168,6 +170,11 @@
|
||||||
(set! code-signature-size (+ size extra)))
|
(set! code-signature-size (+ size extra)))
|
||||||
(log-warning "WARNING: code signature is not at end of file")))
|
(log-warning "WARNING: code signature is not at end of file")))
|
||||||
(log-warning "WARNING: code signature is not last load command"))]
|
(log-warning "WARNING: code signature is not last load command"))]
|
||||||
|
[(#x2B)
|
||||||
|
;; LC_DYLIB_CODE_SIGN_DRS
|
||||||
|
(set! code-sign-drs-pos pos)
|
||||||
|
(let ([offset (read-ulong p)])
|
||||||
|
(set! code-sign-drs-offset offset))]
|
||||||
[else
|
[else
|
||||||
(void)])
|
(void)])
|
||||||
(file-position p (+ pos sz))
|
(file-position p (+ pos sz))
|
||||||
|
@ -229,6 +236,9 @@
|
||||||
(when data-in-code-pos
|
(when data-in-code-pos
|
||||||
(when (data-in-code-pos . > . link-edit-pos)
|
(when (data-in-code-pos . > . link-edit-pos)
|
||||||
(set! data-in-code-pos (+ data-in-code-pos new-cmd-sz))))
|
(set! data-in-code-pos (+ data-in-code-pos new-cmd-sz))))
|
||||||
|
(when code-sign-drs-pos
|
||||||
|
(when (code-sign-drs-pos . > . link-edit-pos)
|
||||||
|
(set! code-sign-drs-pos (+ code-sign-drs-pos new-cmd-sz))))
|
||||||
(set! link-edit-pos (+ link-edit-pos new-cmd-sz))
|
(set! link-edit-pos (+ link-edit-pos new-cmd-sz))
|
||||||
(when move-link-edit?
|
(when move-link-edit?
|
||||||
;; Update link-edit segment entry:
|
;; Update link-edit segment entry:
|
||||||
|
@ -275,6 +285,10 @@
|
||||||
(when data-in-code-pos
|
(when data-in-code-pos
|
||||||
(file-position p (+ data-in-code-pos 8))
|
(file-position p (+ data-in-code-pos 8))
|
||||||
(write-ulong (+ data-in-code-offset outlen) out))
|
(write-ulong (+ data-in-code-offset outlen) out))
|
||||||
|
;; Shift code-sign drs:
|
||||||
|
(when code-sign-drs-pos
|
||||||
|
(file-position p (+ code-sign-drs-pos 8))
|
||||||
|
(write-ulong (+ code-sign-drs-offset outlen) out))
|
||||||
;; Shift dyld-info offs
|
;; Shift dyld-info offs
|
||||||
(when dyld-info-pos
|
(when dyld-info-pos
|
||||||
(let ([update (lambda (n)
|
(let ([update (lambda (n)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user