summaryrefslogtreecommitdiffstats
path: root/lang/icc
diff options
context:
space:
mode:
authornetchild <netchild@FreeBSD.org>2002-09-22 13:05:51 +0000
committernetchild <netchild@FreeBSD.org>2002-09-22 13:05:51 +0000
commit3a1d7b674b9c89caa82819d476cb444bbb6b2445 (patch)
treed4ad99fb85bf07a1e74c484d014a3777ef991bd3 /lang/icc
parentd147944fb44241a8f63e8be1cd4105f63a8ce43d (diff)
downloadFreeBSD-ports-3a1d7b674b9c89caa82819d476cb444bbb6b2445.zip
FreeBSD-ports-3a1d7b674b9c89caa82819d476cb444bbb6b2445.tar.gz
- link libc_pic.a when compiling with "-KPIC -static"
- link libc_p.a/lib_c_r.a when compiling with "-pg -static" - fix unresolved symbols to make "-pg" and "-prof_gen" work Submitted by: marius@alchemy.franken.de Approved by: kris
Diffstat (limited to 'lang/icc')
-rw-r--r--lang/icc/Makefile10
-rw-r--r--lang/icc/files/assert_fail.c40
-rw-r--r--lang/icc/files/ld.c65
-rw-r--r--lang/icc/files/mcount.S34
-rw-r--r--lang/icc/files/patch-icc5
-rw-r--r--lang/icc/files/patch-icpc5
6 files changed, 141 insertions, 18 deletions
diff --git a/lang/icc/Makefile b/lang/icc/Makefile
index 9856205..31e0106 100644
--- a/lang/icc/Makefile
+++ b/lang/icc/Makefile
@@ -7,6 +7,7 @@
PORTNAME= icc
PORTVERSION= 6.0.1.304
+PORTREVISION= 1
CATEGORIES= lang linux devel
MASTER_SITES=
DISTNAME= l_cc_p_6.0.1.304
@@ -105,10 +106,11 @@ post-patch:
# \n-Qlocation,ld,/usr/bin\n\n-sox-\n
do-build:
-# Fix unresolved references in libcxa.a, libimf.a and libunwind.a
- @cd ${WRKSRC} && ${CC} ${CFLAGS} -c ${FILESDIR}/cxa_atexit.c \
- ${FILESDIR}/cxa_finalize.c ${FILESDIR}/errno_location.c \
- ${FILESDIR}/stderr.c && \
+# Fix unresolved references
+ @cd ${WRKSRC} && ${CC} ${CFLAGS} -c ${FILESDIR}/assert_fail.c \
+ ${FILESDIR}/cxa_atexit.c ${FILESDIR}/cxa_finalize.c \
+ ${FILESDIR}/errno_location.c ${FILESDIR}/stderr.c \
+ ${FILESDIR}/mcount.S && \
${AR} q opt/intel/compiler60/ia32/lib/libcxa.a *.o
# Some magic to be able to link
@${CC} ${CFLAGS} -o ${WRKSRC}/opt/intel/compiler60/ia32/bin/ld ${FILESDIR}/ld.c
diff --git a/lang/icc/files/assert_fail.c b/lang/icc/files/assert_fail.c
new file mode 100644
index 0000000..b55be3d
--- /dev/null
+++ b/lang/icc/files/assert_fail.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2002 Marius Strobl
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <err.h>
+#include <stdlib.h>
+
+void
+__assert_fail(const char *failedexpr, const char *file, unsigned int line,
+ const char *fn)
+{
+ warnx("assertion \"%s\" failed: file \"%s\", line %u%s%s%s", failedexpr,
+ file, line, fn ? ", function: \"" : "", fn ? fn : "",
+ fn ? "\"" : "");
+ abort();
+}
diff --git a/lang/icc/files/ld.c b/lang/icc/files/ld.c
index fdd1869..c858bac 100644
--- a/lang/icc/files/ld.c
+++ b/lang/icc/files/ld.c
@@ -143,8 +143,8 @@ int
main(int argc, char *argv[], char *envp[])
{
size_t i;
- int bootstrap, cpp, dynamic, stlinserted, threaded;
- char *prefix;
+ int bootstrap, cpp, dynamic, pic, gprof, stlinserted, threaded;
+ char *libc, *libc_r, *prefix;
struct arglist al;
if (argc == 1)
@@ -154,7 +154,7 @@ main(int argc, char *argv[], char *envp[])
errx(1, "can't get PREFIX");
initarg(&al);
- bootstrap = cpp = dynamic = stlinserted = threaded = 0;
+ bootstrap = cpp = dynamic = pic = gprof = stlinserted = threaded = 0;
#ifdef DEBUG
printf("input: ");
@@ -185,6 +185,11 @@ main(int argc, char *argv[], char *envp[])
continue;
}
+ if (ARGCMP("-PIC")) {
+ pic++;
+ continue;
+ }
+
/*
* If the compiler was called with -static we shouldn't see
* "--dynamic-linker" here.
@@ -217,12 +222,42 @@ main(int argc, char *argv[], char *envp[])
continue;
}
+ /*
+ * Link against libc_p when "-pg" was given, "/usr/lib/gcrt1.o"
+ * indicates this.
+ */
+ if (ARGCMP("/usr/lib/gcrt1.o")) {
+ gprof++;
+ continue;
+ }
+ }
+
+ /*
+ * Use the appropriate libs for libc and libc_r when linking static
+ * and "-KPIC" or "-pg" where given.
+ */
+ if (!dynamic && (pic || gprof)) {
+ /*
+ * Let libc_p win above libc_pic when both, "-KPIC" and "-pg",
+ * where given, GCC does the same.
+ */
+ if (!gprof) {
+ libc = strdup("-lc_pic");
+ libc_r = strdup("-lc_r");
+ } else {
+ libc = strdup("-lc_p");
+ libc_r = strdup("-lc_r_p");
+ }
+ } else {
+ libc = strdup("-lc");
+ libc_r = strdup("-lc_r");
}
#ifdef DEBUG
- printf("\ncpp: %s bootstrap: %s dynamic: %s threaded: %s\n",
- cpp ? "YES" : "NO", bootstrap ? "YES" : "NO",
- dynamic ? "YES" : "NO", threaded ? "YES" : "NO");
+ printf("\ncpp: %s bootstrap: %s dynamic: %s gprof: %s pic: %s "
+ "threaded: %s\n", cpp ? "YES" : "NO", bootstrap ? "YES" : "NO",
+ dynamic ? "YES" : "NO", gprof ? "YES" : "NO", pic ? "YES" : "NO",
+ threaded ? "YES" : "NO");
#endif
if (bootstrap && !cpp)
@@ -230,7 +265,8 @@ main(int argc, char *argv[], char *envp[])
"-CPLUSPLUS");
for (i = 0; i < argc; i++) {
- if (ARGCMP("-CPLUSPLUS") || ARGCMP("-BOOTSTRAPSTLPORT"))
+ if (ARGCMP("-CPLUSPLUS") || ARGCMP("-BOOTSTRAPSTLPORT") ||
+ ARGCMP("-PIC"))
continue;
/* prepend "-melf_i386" to the commandline */
@@ -277,18 +313,23 @@ main(int argc, char *argv[], char *envp[])
* code (libcxa and libunwind depend on libc_r when compiling
* C++ source).
*/
- if ((cpp || threaded) && ARGCMP("-lc")) {
+ if (ARGCMP("-lc")) {
if (al.argc > 0 &&
strncmp(al.argv[al.argc - 1], "-B", strlen("-B")))
addarg(&al,
dynamic ? "-Bdynamic" : "-Bstatic", 1);
+ if (cpp || threaded) {
#if __FreeBSD_version < 500016
- addarg(&al, "-lc_r", 1);
+ addarg(&al, libc_r, 0);
#else
- addarg(&al, "-lc", 1);
- addarg(&al, dynamic ? "-Bdynamic" : "-Bstatic", 1);
- addarg(&al, "-lc_r", 1);
+ addarg(&al, libc, 0);
+ addarg(&al,
+ dynamic ? "-Bdynamic" : "-Bstatic", 1);
+ addarg(&al, libc_r, 0);
#endif
+ } else {
+ addarg(&al, libc, 0);
+ }
continue;
}
diff --git a/lang/icc/files/mcount.S b/lang/icc/files/mcount.S
new file mode 100644
index 0000000..f269f0f
--- /dev/null
+++ b/lang/icc/files/mcount.S
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2002 Marius Strobl
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+ .text
+ .extern .mcount
+ .globl mcount
+ .type mcount,@function
+mcount:
+ jmp .mcount
diff --git a/lang/icc/files/patch-icc b/lang/icc/files/patch-icc
index adcc3f1..66e2ee6 100644
--- a/lang/icc/files/patch-icc
+++ b/lang/icc/files/patch-icc
@@ -1,6 +1,6 @@
--- opt/intel/compiler60/ia32/bin/icc.orig Tue Aug 6 04:34:18 2002
+++ opt/intel/compiler60/ia32/bin/icc Tue Aug 6 04:46:51 2002
-@@ -1,29 +1,49 @@
+@@ -1,29 +1,52 @@
#!/bin/sh
-INTEL_LICENSE_FILE=<INSTALLDIR>/licenses;
@@ -51,6 +51,9 @@
+ echo "Sorry, option '$val1' is not supported on FreeBSD."
+ exit 1
+ fi
++ if [ ${val1} = "-Kpic" ] || [ ${val1} = "-KPIC" ] ; then
++ set -- "$@" "-Qoption,ld,-PIC"
++ fi
+ set -- "$@" "$val1"
+ i=$(($i+1))
+ done
diff --git a/lang/icc/files/patch-icpc b/lang/icc/files/patch-icpc
index a1e3f26..0853a53 100644
--- a/lang/icc/files/patch-icpc
+++ b/lang/icc/files/patch-icpc
@@ -1,6 +1,6 @@
--- opt/intel/compiler60/ia32/bin/icpc.orig Fri Sep 6 02:18:03 2002
+++ opt/intel/compiler60/ia32/bin/icpc Tue Sep 10 18:32:59 2002
-@@ -1,29 +1,42 @@
+@@ -1,29 +1,45 @@
#!/bin/sh
-INTEL_LICENSE_FILE=<INSTALLDIR>/licenses;
@@ -44,6 +44,9 @@
+ echo "Sorry, option '$val1' is not supported on FreeBSD."
+ exit 1
+ fi
++ if [ ${val1} = "-Kpic" ] || [ ${val1} = "-KPIC" ] ; then
++ set -- "$@" "-Qoption,ld,-PIC"
++ fi
+ set -- "$@" "$val1"
+ i=$(($i+1))
+ done
OpenPOWER on IntegriCloud