Upload Tizen:Base source
[external/binutils.git] / debian / patches / 129_ld_mulitarch_dirs.patch
1 # DP: Add multiarch directories to linker search path.
2
3 Index: binutils-2.21.0.20110322/ld/genscripts.sh
4 ===================================================================
5 --- binutils-2.21.0.20110322.orig/ld/genscripts.sh      2011-03-27 18:45:12.283057003 +0000
6 +++ binutils-2.21.0.20110322/ld/genscripts.sh   2011-03-27 18:51:20.623057182 +0000
7 @@ -240,6 +240,65 @@
8  fi
9  
10  LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");/g'`
11 +if [ -n "$DEB_HOST_MULTIARCH" ]; then
12 +    temp_dirs=' '
13 +    for dir in `echo ${LIB_PATH} | sed -e 's/:/ /g'`; do
14 +       case "$dir" in
15 +           ${tool_lib}*|*/${target_alias}/*)
16 +               ;;
17 +           */lib)
18 +               if [ -n "$DEB_HOST_MULTIARCH32" ]; then
19 +                   case $EMULATION_NAME in
20 +                       elf_i386|elf32*)
21 +                           temp_dirs="${temp_dirs}${dir}/$DEB_HOST_MULTIARCH32 ";;
22 +                       *)
23 +                           temp_dirs="${temp_dirs}${dir}/$DEB_HOST_MULTIARCH "
24 +                   esac
25 +               elif [ -n "$DEB_HOST_MULTIARCH64" ]; then
26 +                   case $EMULATION_NAME in
27 +                       elf*_64|elf64*)
28 +                           temp_dirs="${temp_dirs}${dir}/$DEB_HOST_MULTIARCH64 ";;
29 +                       *)
30 +                           temp_dirs="${temp_dirs}${dir}/$DEB_HOST_MULTIARCH "
31 +                   esac
32 +               else
33 +                   temp_dirs="${temp_dirs}${dir}/$DEB_HOST_MULTIARCH "
34 +               fi
35 +               ;;
36 +           */lib32)
37 +               if [ -n "$DEB_HOST_MULTIARCH32" ]; then
38 +                   dir2=$(echo $dir | sed "s,32$,,")
39 +                   temp_dirs="${temp_dirs}${dir2}/$DEB_HOST_MULTIARCH32 "
40 +               fi
41 +               ;;
42 +           */lib64)
43 +               case "${target}" in
44 +                   powerpc64-*-*|s390x-*-*|sparc64-*-*|x86_64-*-linux*)
45 +                       #dir=$(echo $dir | sed "s,64$,,")
46 +                       dir2=$(echo $dir | sed "s,64$,,")
47 +                       temp_dirs="${temp_dirs}${dir2}/$DEB_HOST_MULTIARCH "
48 +                       ;;
49 +                   *)
50 +                       if [ -n "$DEB_HOST_MULTIARCH64" ]; then
51 +                           dir2=$(echo $dir | sed "s,64$,,")
52 +                           temp_dirs="${temp_dirs}${dir2}/$DEB_HOST_MULTIARCH64 "
53 +                       fi
54 +                       ;;
55 +               esac
56 +               ;;
57 +           *)
58 +               ;;
59 +       esac
60 +       temp_dirs="${temp_dirs}${dir} "
61 +    done
62 +    LIB_SEARCH_DIRS=
63 +    for dir in $temp_dirs; do
64 +       if echo "$LIB_SEARCH_DIRS" | fgrep -q "\"$dir\""; then
65 +           continue
66 +       fi
67 +       LIB_SEARCH_DIRS="${LIB_SEARCH_DIRS}SEARCH_DIR(\"$dir\"); "
68 +    done
69 +fi
70  
71  # We need it for testsuite.
72  set $EMULATION_LIBPATH