Author: haubi
Date: 2009-07-06 14:19:20 +0000 (Mon, 06 Jul 2009)
New Revision: 1655
Modified:
trunk/toolchain-prefix-wrapper/ld/hpuxplugin.c
Log:
always filter all default lib- and runpaths added by gcc and ld from
cmdline, re-add gcc-ones always and ld-defaults upon "+b :" only.
Modified: trunk/toolchain-prefix-wrapper/ld/hpuxplugin.c
===================================================================
--- trunk/toolchain-prefix-wrapper/ld/hpuxplugin.c 2009-07-06 12:41:01 UTC (rev 1654)
+++ trunk/toolchain-prefix-wrapper/ld/hpuxplugin.c 2009-07-06 14:19:20 UTC (rev 1655)
@@ -38,6 +38,7 @@
/* ELF settings */
bool needLibpathAsRunpath = true;
+ bool needAutoRunpath = false;
UseRpathFlag useRpathFlag = UseRpath_Last;
bool needCDPflag = false; /* need +cdp linker flag to drop DESTDIR */
@@ -82,26 +83,58 @@
if (autoRunpathList == NULL)
break;
- if (strncmp(StringGetBuffer(data->in->host.triplet), "ia64", strlen("ia64")) == 0) {
+#define STRnLEN(x) (x), strlen((x))
+ argBuffer = StringGetBuffer(data->in->host.triplet);
+ if (strncmp(argBuffer, "ia64", strlen("ia64")) == 0) {
isIA64 = true;
- is64bit = false;
- if (StringGetBuffer(data->in->host.triplet)[strlen("ia64")] == 'w') {
+ if (argBuffer[strlen("ia64")] == 'w') {
/* ia64w: ELF, 64bit */
is64bit = true;
+ if (0
+ /* added by gcc always */
+ || StringListAppendConcat(sysRunpathList, STRnLEN("/usr/ccs/lib/hpux64"), NULL) < 0
+ || StringListAppendConcat(sysRunpathList, STRnLEN("/lib/hpux64" ), NULL) < 0
+ || StringListAppendConcat(sysRunpathList, STRnLEN("/usr/lib/hpux64" ), NULL) < 0
+ || StringListAppendConcat(sysRunpathList, STRnLEN("/usr/ccs/lib" ), NULL) < 0
+ /* added by ld upon "+b :" */
+ || StringListAppendConcat(autoRunpathList, STRnLEN("/usr/lib/hpux64" ), NULL) < 0
+ )
+ break;
+ } else {
+ is64bit = false;
+ if (0
+ /* added by gcc always */
+ || StringListAppendConcat(sysRunpathList, STRnLEN("/usr/ccs/lib" ), NULL) < 0
+ /* added by ld upon "+b :" */
+ || StringListAppendConcat(autoRunpathList, STRnLEN("/usr/lib/hpux32"), NULL) < 0
+ )
+ break;
}
} else
- if (strncmp(StringGetBuffer(data->in->host.triplet), "hppa64", strlen("hppa64")) == 0) {
+ if (strncmp(argBuffer, "hppa64", strlen("hppa64")) == 0) {
/* hppa64: ELF, 64bit */
isIA64 = false;
is64bit = true;
+ if (0
+ /* added by gcc always */
+ || StringListAppendConcat(sysRunpathList, STRnLEN("/usr/ccs/lib/pa20_64" ), NULL) < 0
+ || StringListAppendConcat(sysRunpathList, STRnLEN("/opt/langtools/lib/pa20_64"), NULL) < 0
+ || StringListAppendConcat(sysRunpathList, STRnLEN("/lib/pa20_64" ), NULL) < 0
+ || StringListAppendConcat(sysRunpathList, STRnLEN("/usr/lib/pa20_64" ), NULL) < 0
+ /* added by ld among "+b :" */
+ || StringListAppendConcat(autoRunpathList, STRnLEN("/usr/lib/pa20_64" ), NULL) < 0
+ || StringListAppendConcat(autoRunpathList, STRnLEN("/usr/ccs/lib/pa20_64" ), NULL) < 0
+ )
+ break;
} else {
/* hppa: SOM, 32bit */
isIA64 = false;
is64bit = false;
- if (StringListAppendConcat(sysRunpathList,
- "/usr/ccs/lib", strlen("/usr/ccs/lib"), NULL) < 0
- || StringListAppendConcat(sysRunpathList,
- "/opt/langtools/lib", strlen("/opt/langtools/lib"), NULL) < 0
+ if (0
+ /* added by gcc always */
+ || StringListAppendConcat(sysRunpathList, STRnLEN("/usr/ccs/lib" ), NULL) < 0
+ || StringListAppendConcat(sysRunpathList, STRnLEN("/opt/langtools/lib"), NULL) < 0
+ /* added by ld among "+b :" */
)
break;
}
@@ -182,31 +215,7 @@
if (argBufferLength == 1 && argBuffer[0] == ':') {
/* "+b:" collects all "-L" paths and LPATH envvar */
needLibpathAsRunpath = true;
- /* TODO: getenv("LPATH") */
- if (isIA64 && is64bit) {
- /* ia64w */
- if (StringListAppendConcat(autoRunpathList,
- "/usr/lib/hpux64", strlen("/usr/lib/hpux64"),
- NULL) < 0)
- break;
- } else
- if (isIA64 && !is64bit) {
- /* ia64 */
- if (StringListAppendConcat(autoRunpathList,
- "/usr/lib/hpux32", strlen("/usr/lib/hpux32"),
- NULL) < 0)
- break;
- } else
- if (is64bit) {
- /* hppa64 */
- if (StringListAppendConcat(autoRunpathList,
- "/usr/lib/pa20_64", strlen("/usr/lib/pa20_64"),
- "/usr/ccs/lib/pa20_64", strlen("/usr/ccs/lib/pa20_64"),
- NULL) < 0)
- break;
- } else {
- /* hppa */
- }
+ needAutoRunpath = true;
continue;
}
}
@@ -380,7 +389,9 @@
break;
/* append automatic sys libpath list to runpath list */
- if (StringListAppendList(runpathList, autoRunpathList, 0, -1) < 0)
+ if (needAutoRunpath
+ && StringListAppendList(runpathList, autoRunpathList, 0, -1) < 0
+ )
break;
/* create runpath string: runpath1:runpathN */
@@ -399,7 +410,7 @@
/* do we need the "+cdp ${D}:" flag? */
if (needCDPflag
- && (StringListAppendConcat(data->out->argList, "+cdp", strlen("+cdp"), NULL) < 0
+ && (StringListAppendConcat(data->out->argList, STRnLEN("+cdp"), NULL) < 0
|| StringListAppendConcat(data->out->argList, portageD, portageDlength, ":", 1, NULL) < 0
))
break;
|