diff options
| author | Russ Cox <rsc@golang.org> | 2013-03-10 16:24:01 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2013-03-10 16:24:01 -0400 |
| commit | df6072b41c76f2ac839d248b7c706fa554f483ed (patch) | |
| tree | 82b0780587d8d44f02bf9920cf79b0519cc147a6 /src/cmd/ld/data.c | |
| parent | 85d83c2e51ae67a8f041e3949ffcaef17c7d9d59 (diff) | |
| download | go-df6072b41c76f2ac839d248b7c706fa554f483ed.tar.xz | |
cmd/ld: include full symbol table in Mach-O output
This makes binaries work with OS X nm.
R=ken2
CC=golang-dev
https://golang.org/cl/7558044
Diffstat (limited to 'src/cmd/ld/data.c')
| -rw-r--r-- | src/cmd/ld/data.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/cmd/ld/data.c b/src/cmd/ld/data.c index 10dba90305..3e2af0adb3 100644 --- a/src/cmd/ld/data.c +++ b/src/cmd/ld/data.c @@ -33,6 +33,7 @@ #include "l.h" #include "../ld/lib.h" #include "../ld/elf.h" +#include "../ld/macho.h" #include "../ld/pe.h" #include "../../pkg/runtime/mgc0.h" @@ -943,7 +944,7 @@ gcaddsym(Sym *gc, Sym *s, int32 off) void dodata(void) { - int32 datsize; + int32 n, datsize; Section *sect; Sym *s, *last, **l; Sym *gcdata1, *gcbss1; @@ -992,7 +993,11 @@ dodata(void) * to assign addresses, record all the necessary * dynamic relocations. these will grow the relocation * symbol, which is itself data. + * + * on darwin, we need the symbol table numbers for dynreloc. */ + if(HEADTYPE == Hdarwin) + machosymorder(); dynreloc(); /* some symbols may no longer belong in datap (Mach-O) */ @@ -1218,6 +1223,13 @@ dodata(void) datsize += s->size; sect->len = datsize - sect->vaddr; } + + /* number the sections */ + n = 1; + for(sect = segtext.sect; sect != nil; sect = sect->next) + sect->extnum = n++; + for(sect = segdata.sect; sect != nil; sect = sect->next) + sect->extnum = n++; } // assign addresses to text |
