diff options
author | netchild <netchild@FreeBSD.org> | 2002-09-22 21:05:51 +0800 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2002-09-22 21:05:51 +0800 |
commit | 3a1d7b674b9c89caa82819d476cb444bbb6b2445 (patch) | |
tree | d4ad99fb85bf07a1e74c484d014a3777ef991bd3 /lang/icc7/files | |
parent | d147944fb44241a8f63e8be1cd4105f63a8ce43d (diff) | |
download | freebsd-ports-gnome-3a1d7b674b9c89caa82819d476cb444bbb6b2445.tar.gz freebsd-ports-gnome-3a1d7b674b9c89caa82819d476cb444bbb6b2445.tar.zst freebsd-ports-gnome-3a1d7b674b9c89caa82819d476cb444bbb6b2445.zip |
- 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/icc7/files')
-rw-r--r-- | lang/icc7/files/assert_fail.c | 40 | ||||
-rw-r--r-- | lang/icc7/files/ld.c | 65 | ||||
-rw-r--r-- | lang/icc7/files/mcount.S | 34 | ||||
-rw-r--r-- | lang/icc7/files/patch-icc | 5 | ||||
-rw-r--r-- | lang/icc7/files/patch-icpc | 5 |
5 files changed, 135 insertions, 14 deletions
diff --git a/lang/icc7/files/assert_fail.c b/lang/icc7/files/assert_fail.c new file mode 100644 index 000000000000..b55be3d86ffc --- /dev/null +++ b/lang/icc7/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/icc7/files/ld.c b/lang/icc7/files/ld.c index fdd1869bba13..c858bacd8e4c 100644 --- a/lang/icc7/files/ld.c +++ b/lang/icc7/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/icc7/files/mcount.S b/lang/icc7/files/mcount.S new file mode 100644 index 000000000000..f269f0f06bea --- /dev/null +++ b/lang/icc7/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/icc7/files/patch-icc b/lang/icc7/files/patch-icc index adcc3f15a4b4..66e2ee66830a 100644 --- a/lang/icc7/files/patch-icc +++ b/lang/icc7/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/icc7/files/patch-icpc b/lang/icc7/files/patch-icpc index a1e3f2685e08..0853a53798bd 100644 --- a/lang/icc7/files/patch-icpc +++ b/lang/icc7/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 |