summaryrefslogtreecommitdiff
path: root/binutils/patches/129_ld_mulitarch_dirs.patch
blob: 2beedf65d86ea23fca9ee307628c0888af223757 (plain)
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
67
68
69
70
71
72
# DP: Add multiarch directories to linker search path.

Index: binutils-2.21.0.20110322/ld/genscripts.sh
===================================================================
--- binutils-2.21.0.20110322.orig/ld/genscripts.sh	2011-03-27 18:45:12.283057003 +0000
+++ binutils-2.21.0.20110322/ld/genscripts.sh	2011-03-27 18:51:20.623057182 +0000
@@ -240,6 +240,65 @@
 fi
 
 LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'`
+if [ -n "$DEB_HOST_MULTIARCH" ]; then
+    temp_dirs=' '
+    for dir in `echo ${LIB_PATH} | sed -e 's/:/ /g'`; do
+	case "$dir" in
+	    ${tool_lib}*|*/${target_alias}/*)
+	        ;;
+	    */lib)
+		if [ -n "$DEB_HOST_MULTIARCH32" ]; then
+		    case $EMULATION_NAME in
+			elf_i386|elf32*)
+			    temp_dirs="${temp_dirs}${dir}/$DEB_HOST_MULTIARCH32 ";;
+			*)
+			    temp_dirs="${temp_dirs}${dir}/$DEB_HOST_MULTIARCH "
+		    esac
+		elif [ -n "$DEB_HOST_MULTIARCH64" ]; then
+		    case $EMULATION_NAME in
+			elf*_64|elf64*)
+			    temp_dirs="${temp_dirs}${dir}/$DEB_HOST_MULTIARCH64 ";;
+			*)
+			    temp_dirs="${temp_dirs}${dir}/$DEB_HOST_MULTIARCH "
+		    esac
+		else
+		    temp_dirs="${temp_dirs}${dir}/$DEB_HOST_MULTIARCH "
+		fi
+		;;
+	    */lib32)
+	        if [ -n "$DEB_HOST_MULTIARCH32" ]; then
+		    dir2=$(echo $dir | sed "s,32$,,")
+		    temp_dirs="${temp_dirs}${dir2}/$DEB_HOST_MULTIARCH32 "
+		fi
+		;;
+	    */lib64)
+	        case "${target}" in
+		    powerpc64-*-*|s390x-*-*|sparc64-*-*|x86_64-*-linux*)
+			#dir=$(echo $dir | sed "s,64$,,")
+			dir2=$(echo $dir | sed "s,64$,,")
+			temp_dirs="${temp_dirs}${dir2}/$DEB_HOST_MULTIARCH "
+			;;
+		    *)
+			if [ -n "$DEB_HOST_MULTIARCH64" ]; then
+			    dir2=$(echo $dir | sed "s,64$,,")
+			    temp_dirs="${temp_dirs}${dir2}/$DEB_HOST_MULTIARCH64 "
+			fi
+			;;
+		esac
+	        ;;
+	    *)
+		;;
+	esac
+	temp_dirs="${temp_dirs}${dir} "
+    done
+    LIB_SEARCH_DIRS=
+    for dir in $temp_dirs; do
+	if echo "$LIB_SEARCH_DIRS" | fgrep -q "\"$dir\""; then
+	    continue
+	fi
+	LIB_SEARCH_DIRS="${LIB_SEARCH_DIRS}SEARCH_DIR(\"$dir\"); "
+    done
+fi
 
 # We need it for testsuite.
 set $EMULATION_LIBPATH