summaryrefslogtreecommitdiff
path: root/lang/icc/files/ld.c
diff options
context:
space:
mode:
Diffstat (limited to 'lang/icc/files/ld.c')
-rw-r--r--lang/icc/files/ld.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/lang/icc/files/ld.c b/lang/icc/files/ld.c
index a55671768e79..66420cebfeae 100644
--- a/lang/icc/files/ld.c
+++ b/lang/icc/files/ld.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#define LDW_GPROF (1<<2)
#define LDW_PIC (1<<3)
#define LDW_THR (1<<4)
+#define LDW_LGCC (1<<5)
struct arglist {
size_t argc;
@@ -76,7 +77,7 @@ main(int argc, char *argv[], char *envp[])
{
size_t i;
u_int flags;
- const char *libc, *libthr, *prefix;
+ const char *libc, *libthr, *icc_localbase;
struct arglist al = { 0, NULL };
flags = 0;
@@ -84,8 +85,8 @@ main(int argc, char *argv[], char *envp[])
if (argc == 1)
errx(1, "no input files");
- if ((prefix = getenv("PREFIX")) == NULL)
- errx(1, "can't get PREFIX");
+ if ((icc_localbase = getenv("ICC_LOCALBASE")) == NULL)
+ errx(1, "can't get ICC_LOCALBASE");
#ifdef DEBUG
printf("input: ");
@@ -140,6 +141,11 @@ main(int argc, char *argv[], char *envp[])
flags |= LDW_GPROF;
continue;
}
+
+ if (ARGCMP(i, "-lgcc")) {
+ flags |= LDW_LGCC;
+ continue;
+ }
}
/*
@@ -192,8 +198,8 @@ main(int argc, char *argv[], char *envp[])
continue;
}
- /* Don't add obsolete flag "-Qy". */
- if (ARGCMP(i, "-Qy"))
+ /* Don't add obsolete flag "-Qy", don't add libgcc_s. */
+ if (ARGCMP(i, "-Qy") || ARGCMP(i, "-lgcc_s"))
continue;
/*
@@ -202,7 +208,7 @@ main(int argc, char *argv[], char *envp[])
* in both, the static and the dynamic, versions.
*/
if (ARGCMP(i, "-lcprts")) {
- if (flags & LDW_CPP) {
+ if (flags & LDW_CPP && !(flags & LDW_LGCC)) {
addarg(&al,
flags & LDW_DYN ? "-Bdynamic" : "-Bstatic");
addarg(&al, "-lstlport_icc");
@@ -245,9 +251,9 @@ main(int argc, char *argv[], char *envp[])
addarg(&al, "-L/usr/libexec/elf");
addarg(&al, "-L/usr/libexec");
addarg(&al, "-L/usr/lib");
- if (flags & LDW_CPP) {
+ if (flags & LDW_CPP && !(flags & LDW_LGCC)) {
char *p;
- asprintf(&p, "-L%s/lib", prefix);
+ asprintf(&p, "-L%s/lib", icc_localbase);
if (p == NULL)
err(1, NULL);
addarg(&al, p);
@@ -256,24 +262,27 @@ main(int argc, char *argv[], char *envp[])
}
/*
- * Force libcxa and libunwind to static linkage, since the
- * dynamic versions have glibc dependencies.
+ * Force libcxa, libcxaguard and libunwind to static linkage,
+ * since the dynamic versions have glibc dependencies.
* Don't add superfluous -Bdynamic.
*/
if (ARGCMP(i, "-Bdynamic") && i < argc - 1) {
if (ARGCMP(i + 1, "-lcxa") ||
+ ARGCMP(i + 1, "-lcxaguard") ||
ARGCMP(i + 1, "-lunwind")) {
addarg(&al, "-Bstatic");
continue;
}
- if (ARGCMP(i + 1, "-lcprts"))
+ if (ARGCMP(i + 1, "-lcprts") ||
+ ARGCMP(i + 1, "-lgcc_s"))
continue;
}
/* Don't add superfluous -Bstatic. */
if (ARGCMP(i, "-Bstatic") && i < argc - 1 &&
- (ARGCMP(i + 1, "-lcprts") || ARGCMP(i + 1, "-lunwind")))
+ (ARGCMP(i + 1, "-lcprts") || ARGCMP(i + 1, "-lgcc_s") ||
+ ARGCMP(i + 1, "-lunwind")))
continue;
/*
@@ -282,9 +291,9 @@ main(int argc, char *argv[], char *envp[])
*/
if (!strncmp(argv[i], "-l", 2) && al.argc > 0 &&
strncmp(al.argv[al.argc - 1], "-B", 2)) {
- if (ARGCMP(i, "-lcxa") || ARGCMP(i, "-limf") ||
- ARGCMP(i, "-lirc") || ARGCMP(i, "-lircmt") ||
- ARGCMP(i, "-lunwind"))
+ if (ARGCMP(i, "-lcxa") || ARGCMP(i, "-lcxaguard") ||
+ ARGCMP(i, "-limf") || ARGCMP(i, "-lirc") ||
+ ARGCMP(i, "-lircmt") || ARGCMP(i, "-lunwind"))
addarg(&al, "-Bstatic");
else
addarg(&al,