mirror of
https://github.com/golang/go.git
synced 2024-09-29 22:37:06 +00:00
cmd/ld: don't pass -rdynamic to external linker if -static is used
Fixes #7800. LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/87790051
This commit is contained in:
parent
32dffef098
commit
827aab07b8
@ -654,6 +654,20 @@ hostlink(void)
|
||||
if(*p == '\0')
|
||||
break;
|
||||
argv[argc++] = p;
|
||||
|
||||
// clang, unlike GCC, passes -rdynamic to the linker
|
||||
// even when linking with -static, causing a linker
|
||||
// error when using GNU ld. So take out -rdynamic if
|
||||
// we added it. We do it in this order, rather than
|
||||
// only adding -rdynamic later, so that -extldflags
|
||||
// can override -rdynamic without using -static.
|
||||
if(iself && strncmp(p, "-static", 7) == 0 && (p[7]==' ' || p[7]=='\0')) {
|
||||
for(i=0; i<argc; i++) {
|
||||
if(strcmp(argv[i], "-rdynamic") == 0)
|
||||
argv[i] = "-static";
|
||||
}
|
||||
}
|
||||
|
||||
p = strchr(p + 1, ' ');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user