blob: 96a0a80b04e883af8f0e49ae5e316b1a01718bbb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
diff -ur go/src/cmd/go/internal/work/buildid.go go+iPhone/src/cmd/go/internal/work/buildid.go
--- go/src/cmd/go/internal/work/buildid.go 2019-03-14 19:59:48.000000000 +0000
+++ go+iPhone/src/cmd/go/internal/work/buildid.go 2019-05-10 06:06:28.663451891 +0000
@@ -660,6 +660,15 @@
if err := w.Close(); err != nil {
return err
}
+
+ // MCApollo: Rehash/sign binary (again) because it has changed.
+ // Hacky workaround for iOS codesigning.
+ if strings.Contains(target, "a.out") {
+ cmd := exec.Command("ldid", "-S/usr/share/entitlements/global.xml", target)
+ if err := cmd.Run(); err != nil {
+ fmt.Errorf("Failed to rehash binary with ldid.")
+ }
+ }
}
// Cache package builds, but not binaries (link steps).
diff -ur go/src/cmd/link/internal/ld/main.go go+iPhone/src/cmd/link/internal/ld/main.go
--- go/src/cmd/link/internal/ld/main.go 2019-03-14 19:59:48.000000000 +0000
+++ go+iPhone/src/cmd/link/internal/ld/main.go 2019-05-10 06:01:34.695262524 +0000
@@ -38,6 +38,7 @@
"flag"
"log"
"os"
+ "os/exec"
"runtime"
"runtime/pprof"
"strings"
@@ -246,6 +247,16 @@
ctxt.Bso.Flush()
+ // MCApollo: A dirty hack for native compiling
+ if nerrors == 0 && ctxt.HeadType == objabi.Hdarwin {
+ Outfile := *flagOutfile
+ // Maybe I should provide the file instead of hoping it's there?
+ cmd := exec.Command("ldid", "-S/usr/share/entitlements/global.xml", Outfile)
+ if err := cmd.Run(); err != nil && ctxt.Debugvlog != 0 {
+ ctxt.Logf("Failed to sign with ldid!\n")
+ }
+ }
+
errorexit()
}
|