blob: 3c228fb5d445e1bdc5f0f12f2e59443f5f3b02ec (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#! /bin/sh
# icc custom ld script; fiddles with the ld commandline. This is done
# by shifting through the entire argument list. If we like the arg, we
# append it to the end of the arglist via 'set'. If not, we don't
# append anything, and the arg is shifted out of existence.
# Written by Dan Nelson <dnelson@allantgroup.com> with some modifications
# by Alexander Leidinger <netchild@FreeBSD.org>.
PREFIX=@@PREFIX@@
i=0
argc=$#
# prepend "-m elf_i386" to the commandline
set -- "$@" -m elf_i386
while [ $i -lt $argc ] ; do
val=$1
shift
case $val in
# there was also "-lirc", but it a test with -lirc works here
-limf|-lcprts|-lunwind|\
${PREFIX}/intel/compiler60/ia32/lib/icrt.link|\
-Qy\
)
# libs that have Linux lib dependencies
# possibly unneeded .link file?
# obsolete flag
unset val
;;
/lib/ld-linux.so.2)
# switch it
val=/usr/libexec/ld-elf.so.1
;;
-L/usr/lib)
# remove this, and replace with FreeBSD's lib paths
unset val
set -- "$@" -L/usr/libexec/elf -L/usr/libexec -L/usr/lib
;;
${PREFIX}/intel/compiler60/ia32/lib/crtxi.o)
# switch it
val=/usr/lib/crtbegin.o
;;
${PREFIX}/intel/compiler60/ia32/lib/crtxn.o)
# switch it good
val=/usr/lib/crtend.o
;;
-Bdynamic)
# Force libcxa to static linkage, since the dynamic
# version has a linux glibc dependency. This might not
# fully work, as when it does call libc stuff it could
# fail. I haven't been able to make it happen though.
if [ "$1" == "-lcxa" ] ; then
val=-Bstatic
fi
;;
*)
;;
esac
# append our new $val to the end of argv, if it still exists.
if [ ${#val} -gt 0 ] ; then
set -- "$@" "$val"
fi
i=$(($i+1))
done
# run FreeBSD's ld with our new args
exec ${PREFIX}/intel/compiler60/ia32/bin/real/ld "$@"
|