mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/ld: output dwarf in external link mode on darwin
Fixes #8973 Change-Id: Idd53fc6d9e6971ae31ed72a3df3cfdce0bfbc1fd Reviewed-on: https://go-review.googlesource.com/8661 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
9c9e36b340
commit
8b83306cf2
8 changed files with 527 additions and 58 deletions
|
|
@ -922,7 +922,7 @@ func hostlink() {
|
|||
}
|
||||
|
||||
if HEADTYPE == obj.Hdarwin {
|
||||
argv = append(argv, "-Wl,-no_pie,-pagezero_size,4000000")
|
||||
argv = append(argv, "-Wl,-no_pie,-pagezero_size,4000000,-headerpad,1144")
|
||||
}
|
||||
if HEADTYPE == obj.Hopenbsd {
|
||||
argv = append(argv, "-Wl,-nopie")
|
||||
|
|
@ -1029,6 +1029,25 @@ func hostlink() {
|
|||
if out, err := exec.Command(argv[0], argv[1:]...).CombinedOutput(); err != nil {
|
||||
Exitf("running %s failed: %v\n%s", argv[0], err, out)
|
||||
}
|
||||
|
||||
if Debug['s'] == 0 && debug_s == 0 && HEADTYPE == obj.Hdarwin {
|
||||
dsym := fmt.Sprintf("%s/go.dwarf", tmpdir)
|
||||
if out, err := exec.Command("dsymutil", "-f", outfile, "-o", dsym).CombinedOutput(); err != nil {
|
||||
Ctxt.Cursym = nil
|
||||
Exitf("%s: running dsymutil failed: %v\n%s", os.Args[0], err, out)
|
||||
}
|
||||
combinedOutput := fmt.Sprintf("%s/go.combined", tmpdir)
|
||||
if err := machoCombineDwarf(outfile, dsym, combinedOutput); err != nil {
|
||||
Ctxt.Cursym = nil
|
||||
Exitf("%s: combining dwarf failed: %v", os.Args[0], err)
|
||||
}
|
||||
origOutput := fmt.Sprintf("%s/go.orig", tmpdir)
|
||||
os.Rename(outfile, origOutput)
|
||||
if err := os.Rename(combinedOutput, outfile); err != nil {
|
||||
Ctxt.Cursym = nil
|
||||
Exitf("%s: rename(%s, %s) failed: %v", os.Args[0], combinedOutput, outfile, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func ldobj(f *obj.Biobuf, pkg string, length int64, pn string, file string, whence int) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue