1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:34:40 -07:00

ld: fix 6l -d on Mac, diagnose invalid use of -d

R=r
CC=golang-dev
https://golang.org/cl/4430064
This commit is contained in:
Russ Cox 2011-04-25 13:57:52 -04:00
parent 07abf1c732
commit c2c7ee2736
2 changed files with 10 additions and 2 deletions

View File

@ -445,6 +445,12 @@ loaddynimport(char *file, char *pkg, char *p, int n)
*strchr(name, ' ') = 0; *strchr(name, ' ') = 0;
*strchr(def, ' ') = 0; *strchr(def, ' ') = 0;
if(debug['d']) {
fprint(2, "%s: %s: cannot use dynamic imports with -d flag\n", argv0, file);
nerrors++;
return;
}
if(strcmp(name, "_") == 0 && strcmp(def, "_") == 0) { if(strcmp(name, "_") == 0 && strcmp(def, "_") == 0) {
// allow #pragma dynimport _ _ "foo.so" // allow #pragma dynimport _ _ "foo.so"
// to force a link of foo.so. // to force a link of foo.so.
@ -463,7 +469,7 @@ loaddynimport(char *file, char *pkg, char *p, int n)
return; return;
err: err:
fprint(2, "%s: invalid dynimport line: %s\n", argv0, p0); fprint(2, "%s: %s: invalid dynimport line: %s\n", argv0, file, p0);
nerrors++; nerrors++;
} }

View File

@ -349,11 +349,13 @@ asmbmacho(void)
msect = newMachoSect(ms, "__data"); msect = newMachoSect(ms, "__data");
msect->addr = va+v; msect->addr = va+v;
msect->size = symaddr(lookup(".got", 0)) - msect->addr;
msect->off = v; msect->off = v;
msect->size = segdata.filelen;
s = lookup(".got", 0); s = lookup(".got", 0);
if(s->size > 0) { if(s->size > 0) {
msect->size = symaddr(s) - msect->addr;
msect = newMachoSect(ms, "__nl_symbol_ptr"); msect = newMachoSect(ms, "__nl_symbol_ptr");
msect->addr = symaddr(s); msect->addr = symaddr(s);
msect->size = s->size; msect->size = s->size;