Commit c2c7ee27 authored by Russ Cox's avatar Russ Cox

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

R=r
CC=golang-dev
https://golang.org/cl/4430064
parent 07abf1c7
...@@ -445,6 +445,12 @@ loaddynimport(char *file, char *pkg, char *p, int n) ...@@ -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) ...@@ -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++;
} }
......
...@@ -349,11 +349,13 @@ asmbmacho(void) ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment