]> Cypherpunks repositories - gostls13.git/commitdiff
6l: work with OS X nm/otool
authorJim McGrath <jimmc2@gmail.com>
Tue, 12 Oct 2010 20:52:17 +0000 (16:52 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 12 Oct 2010 20:52:17 +0000 (16:52 -0400)
6l was skipping emitting the (2 byte) symbol table if there were no imported or exported
symbols. You can't just drop the symbol table entirely - the linker dies if you have
a linkedit section but no table. You can omit the linkedit section or both the linkedit
and the dlyd parts in the right circumstances, but that seems much more risky to me.

R=rsc
CC=golang-dev
https://golang.org/cl/2421042

src/cmd/ld/macho.c

index a3d302401e78a9cf76d09c94f1cf410f99eb643a..799daf87aef718271980029974f8cd9a6dc2904a 100644 (file)
@@ -410,7 +410,7 @@ domacholink(void)
        uint64 val;
 
        linkoff = 0;
-       if(nlinkdata > 0) {
+       if(nlinkdata > 0 || nstrtab > 0) {
                linkoff = rnd(HEADR+textsize, INITRND) + rnd(datsize, INITRND);
                seek(cout, linkoff, 0);