diff options
author | Russ Cox <rsc@golang.org> | 2013-03-19 16:31:52 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2013-03-19 16:31:52 -0400 |
commit | fe20b2a57e0d885c158cafdd7cfdb59675ed35ba (patch) | |
tree | 01c252fe752eaab4c9c8c7f469e45bbdd7b806a2 /src/cmd/ld/lib.c | |
parent | 58cd436fe9ad7649ba00cc940ca16267fe18292d (diff) | |
download | go-fe20b2a57e0d885c158cafdd7cfdb59675ed35ba.tar.gz |
cmd/ld: generate relocated DWARF in hostobj mode
While we're here, downgrade DWARF to version 2.
We're not using any version 3 features, and OS X gdb
only supports version 2.
Fixes issue 3436.
R=golang-dev, minux.ma
CC=golang-dev
https://codereview.appspot.com/7891044
Diffstat (limited to 'src/cmd/ld/lib.c')
-rw-r--r-- | src/cmd/ld/lib.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c index 450a83716..18cae3175 100644 --- a/src/cmd/ld/lib.c +++ b/src/cmd/ld/lib.c @@ -287,6 +287,7 @@ void loadlib(void) { int i, w, x; + Sym *s; loadinternal("runtime"); if(thechar == '5') @@ -301,12 +302,21 @@ loadlib(void) objfile(library[i].file, library[i].pkg); } + if(linkmode == LinkExternal && !iscgo) + linkmode = LinkInternal; + // If we got this far in automatic mode, there were no // cgo uses that suggest we need external mode. // Switch to internal. - if(linkmode == LinkAuto) + if(linkmode == LinkAuto) { linkmode = LinkInternal; - + // Drop all the cgo_import_static declarations. + // Turns out we won't be needing them. + for(s = allsym; s != S; s = s->allsym) + if(s->type == SHOSTOBJ) + s->type = 0; + } + // Now that we know the link mode, trim the dynexp list. x = CgoExportDynamic; if(linkmode == LinkExternal) @@ -497,9 +507,11 @@ int mhostobj; // These packages can use internal linking mode. // Others trigger external mode. const char *internalpkg[] = { + "crypto/x509", "net", "os/user", - "runtime/cgo" + "runtime/cgo", + "runtime/race" }; void @@ -618,7 +630,7 @@ hostlink(void) break; } if(!debug['s']) - argv[argc++] = "-ggdb"; + argv[argc++] = "-gdwarf-2"; if(HEADTYPE == Hdarwin) argv[argc++] = "-Wl,-no_pie,-pagezero_size,4000000"; argv[argc++] = "-o"; |