Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
280d85a8
Commit
280d85a8
authored
Jan 23, 2012
by
Mikkel Krautz
Committed by
Russ Cox
Jan 23, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ld: fix Mach-O code signing for non-cgo binaries
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/5561060
parent
b35cef67
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
macho.c
src/cmd/ld/macho.c
+18
-1
No files found.
src/cmd/ld/macho.c
View file @
280d85a8
...
@@ -499,7 +499,24 @@ domacholink(void)
...
@@ -499,7 +499,24 @@ domacholink(void)
s3
=
lookup
(
".linkedit.got"
,
0
);
s3
=
lookup
(
".linkedit.got"
,
0
);
s4
=
lookup
(
".dynstr"
,
0
);
s4
=
lookup
(
".dynstr"
,
0
);
while
(
s4
->
size
%
4
)
// Force the linkedit section to end on a 16-byte
// boundary. This allows pure (non-cgo) Go binaries
// to be code signed correctly.
//
// Apple's codesign_allocate (a helper utility for
// the codesign utility) can do this fine itself if
// it is run on a dynamic Mach-O binary. However,
// when it is run on a pure (non-cgo) Go binary, where
// the linkedit section is mostly empty, it fails to
// account for the extra padding that it itself adds
// when adding the LC_CODE_SIGNATURE load command
// (which must be aligned on a 16-byte boundary).
//
// By forcing the linkedit section to end on a 16-byte
// boundary, codesign_allocate will not need to apply
// any alignment padding itself, working around the
// issue.
while
(
s4
->
size
%
16
)
adduint8
(
s4
,
0
);
adduint8
(
s4
,
0
);
size
=
s1
->
size
+
s2
->
size
+
s3
->
size
+
s4
->
size
;
size
=
s1
->
size
+
s2
->
size
+
s3
->
size
+
s4
->
size
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment