summaryrefslogtreecommitdiff
path: root/data/golang/ldid.diff
diff options
context:
space:
mode:
authorMCApollo <34170230+MCApollo@users.noreply.github.com>2019-05-10 06:32:12 +0000
committerMCApollo <34170230+MCApollo@users.noreply.github.com>2019-05-10 06:32:12 +0000
commita2dae7da3a67dfcef7e1db3da4da79545ff69d10 (patch)
treeb08bfe5db23a4e3176490c20783a7fc4e0b601b3 /data/golang/ldid.diff
parent5653d29a4329dc4a7c4f9faae615e139fdb94ebf (diff)
Added golang.
Diffstat (limited to 'data/golang/ldid.diff')
-rw-r--r--data/golang/ldid.diff47
1 files changed, 47 insertions, 0 deletions
diff --git a/data/golang/ldid.diff b/data/golang/ldid.diff
new file mode 100644
index 000000000..96a0a80b0
--- /dev/null
+++ b/data/golang/ldid.diff
@@ -0,0 +1,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()
+ }
+