]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: use xcode strip for macho combine dwarf
authorMeng Zhuo <mengzhuo1203@gmail.com>
Fri, 16 Oct 2020 01:19:00 +0000 (09:19 +0800)
committerCherry Zhang <cherryyz@google.com>
Fri, 23 Oct 2020 15:54:44 +0000 (15:54 +0000)
The GNU strip will shrink text section while xcodetool strip don't.
We have to use xcodetool strip from system explicitly.

Fixes #41967

Change-Id: Ida372869e0ebc9e93f883640b1614836cea3672f
Reviewed-on: https://go-review.googlesource.com/c/go/+/262398
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Meng Zhuo <mzh@golangcn.org>

src/cmd/link/internal/ld/lib.go

index a68725bef950e732691feb897c9333988a5eefcc..aaf443903c10f48019cc4ab5654522082a6082ae 100644 (file)
@@ -1614,12 +1614,12 @@ func (ctxt *Link) hostlink() {
 
        if combineDwarf {
                dsym := filepath.Join(*flagTmpdir, "go.dwarf")
-               if out, err := exec.Command("dsymutil", "-f", *flagOutfile, "-o", dsym).CombinedOutput(); err != nil {
+               if out, err := exec.Command("xcrun", "dsymutil", "-f", *flagOutfile, "-o", dsym).CombinedOutput(); err != nil {
                        Exitf("%s: running dsymutil failed: %v\n%s", os.Args[0], err, out)
                }
                // Remove STAB (symbolic debugging) symbols after we are done with them (by dsymutil).
                // They contain temporary file paths and make the build not reproducible.
-               if out, err := exec.Command("strip", "-S", *flagOutfile).CombinedOutput(); err != nil {
+               if out, err := exec.Command("xcrun", "strip", "-S", *flagOutfile).CombinedOutput(); err != nil {
                        Exitf("%s: running strip failed: %v\n%s", os.Args[0], err, out)
                }
                // Skip combining if `dsymutil` didn't generate a file. See #11994.