binutils-2.20.1: Update libtool files so cross native builds are correct.
authorKhem Raj <raj.khem@gmail.com>
Tue, 15 Jun 2010 14:15:06 +0000 (07:15 -0700)
committerKhem Raj <raj.khem@gmail.com>
Tue, 15 Jun 2010 14:22:25 +0000 (07:22 -0700)
* Currently libtool adds -L/usr/lib to the link command which directs
  linker to pull from /usr/lib. Many distro's dont have stuff which is
  conflicting in /usr/lib with the target libraries but some do. Like
  archlinux has libgcc_s.so.1 in /usr/lib due to the above -L it gets
  picked over the target libgcc and the link command fails. -L/usr/lib
  is generated by libtool when it sees -rpath /usr/lib which may be not
  the right think when doing cross native builds.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
recipes/binutils/binutils-2.20.1/libtool-update.patch [new file with mode: 0644]
recipes/binutils/binutils_2.20.1.bb

diff --git a/recipes/binutils/binutils-2.20.1/libtool-update.patch b/recipes/binutils/binutils-2.20.1/libtool-update.patch
new file mode 100644 (file)
index 0000000..0023747
--- /dev/null
@@ -0,0 +1,473 @@
+Index: binutils-2.20.1/libtool.m4
+===================================================================
+--- binutils-2.20.1.orig/libtool.m4
++++ binutils-2.20.1/libtool.m4
+@@ -89,7 +89,8 @@ _LT_SET_OPTIONS([$0], [$1])
+ LIBTOOL_DEPS="$ltmain"
+ # Always use our own libtool.
+-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
++LIBTOOL='$(SHELL) $(top_builddir)'
++LIBTOOL="$LIBTOOL/$host_alias-libtool"
+ AC_SUBST(LIBTOOL)dnl
+ _LT_SETUP
+@@ -211,7 +212,7 @@ delay_single_quote_subst='s/'\''/'\'\\\\
+ no_glob_subst='s/\*/\\\*/g'
+ # Global variables:
+-ofile=libtool
++ofile=${host_alias}-libtool
+ can_build_shared=yes
+ # All known linkers require a `.a' archive for static linking (except MSVC,
+@@ -2445,7 +2446,7 @@ linux*oldld* | linux*aout* | linux*coff*
+   ;;
+ # This must be Linux ELF.
+-linux* | k*bsd*-gnu | kopensolaris*-gnu)
++linux* | k*bsd*-gnu)
+   version_type=linux
+   need_lib_prefix=no
+   need_version=no
+@@ -2454,21 +2455,16 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+   shlibpath_var=LD_LIBRARY_PATH
+   shlibpath_overrides_runpath=no
+-
+   # Some binutils ld are patched to set DT_RUNPATH
+-  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+-    [lt_cv_shlibpath_overrides_runpath=no
+-    save_LDFLAGS=$LDFLAGS
+-    save_libdir=$libdir
+-    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+-       LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+-    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+-      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+-       [lt_cv_shlibpath_overrides_runpath=yes])])
+-    LDFLAGS=$save_LDFLAGS
+-    libdir=$save_libdir
+-    ])
+-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
++  save_LDFLAGS=$LDFLAGS
++  save_libdir=$libdir
++  eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
++       LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
++  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
++    [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
++       [shlibpath_overrides_runpath=yes])])
++  LDFLAGS=$save_LDFLAGS
++  libdir=$save_libdir
+   # This implies no fast_install, which is unacceptable.
+   # Some rework will be needed to allow for fast_install
+@@ -3077,7 +3073,7 @@ irix5* | irix6* | nonstopux*)
+   ;;
+ # This must be Linux ELF.
+-linux* | k*bsd*-gnu | kopensolaris*-gnu)
++linux* | k*bsd*-gnu)
+   lt_cv_deplibs_check_method=pass_all
+   ;;
+@@ -3698,7 +3694,7 @@ m4_if([$1], [CXX], [
+           ;;
+       esac
+       ;;
+-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
++      linux* | k*bsd*-gnu)
+       case $cc_basename in
+         KCC*)
+           # KAI C++ Compiler
+@@ -3982,7 +3978,7 @@ m4_if([$1], [CXX], [
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+       ;;
+-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
++    linux* | k*bsd*-gnu)
+       case $cc_basename in
+       # old Intel for x86_64 which still supported -KPIC.
+       ecc*)
+@@ -4363,7 +4359,7 @@ _LT_EOF
+       _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       ;;
+-    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
++    gnu* | linux* | tpf* | k*bsd*-gnu)
+       tmp_diet=no
+       if test "$host_os" = linux-dietlibc; then
+       case $cc_basename in
+@@ -5116,38 +5112,36 @@ x|xyes)
+       # Test whether the compiler implicitly links with -lc since on some
+       # systems, -lgcc has to come before -lc. If gcc already passes -lc
+       # to ld, don't add -lc before -lgcc.
+-      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+-      [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+-      [$RM conftest*
+-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+-
+-      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+-        soname=conftest
+-        lib=conftest
+-        libobjs=conftest.$ac_objext
+-        deplibs=
+-        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+-        pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+-        compiler_flags=-v
+-        linker_flags=-v
+-        verstring=
+-        output_objdir=.
+-        libname=conftest
+-        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+-        _LT_TAGVAR(allow_undefined_flag, $1)=
+-        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+-        then
+-          lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+-        else
+-          lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+-        fi
+-        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+-      else
+-        cat conftest.err 1>&5
+-      fi
+-      $RM conftest*
+-      ])
+-      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
++      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
++      $RM conftest*
++      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
++
++      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
++        soname=conftest
++        lib=conftest
++        libobjs=conftest.$ac_objext
++        deplibs=
++        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
++      pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
++        compiler_flags=-v
++        linker_flags=-v
++        verstring=
++        output_objdir=.
++        libname=conftest
++        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
++        _LT_TAGVAR(allow_undefined_flag, $1)=
++        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
++        then
++        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
++        else
++        _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
++        fi
++        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
++      else
++        cat conftest.err 1>&5
++      fi
++      $RM conftest*
++      AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
+       ;;
+     esac
+   fi
+@@ -5848,7 +5842,7 @@ if test "$_lt_caught_CXX_error" != yes;
+         _LT_TAGVAR(inherit_rpath, $1)=yes
+         ;;
+-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
++      linux* | k*bsd*-gnu)
+         case $cc_basename in
+           KCC*)
+           # Kuck and Associates, Inc. (KAI) C++ Compiler
+Index: binutils-2.20.1/ltmain.sh
+===================================================================
+--- binutils-2.20.1.orig/ltmain.sh
++++ binutils-2.20.1/ltmain.sh
+@@ -116,15 +116,15 @@ $lt_unset CDPATH
+ : ${CP="cp -f"}
+ : ${ECHO="echo"}
+-: ${EGREP="/usr/bin/grep -E"}
+-: ${FGREP="/usr/bin/grep -F"}
+-: ${GREP="/usr/bin/grep"}
++: ${EGREP="/bin/grep -E"}
++: ${FGREP="/bin/grep -F"}
++: ${GREP="/bin/grep"}
+ : ${LN_S="ln -s"}
+ : ${MAKE="make"}
+ : ${MKDIR="mkdir"}
+ : ${MV="mv -f"}
+ : ${RM="rm -f"}
+-: ${SED="/opt/local/bin/gsed"}
++: ${SED="/bin/sed"}
+ : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+ : ${Xsed="$SED -e 1s/^X//"}
+@@ -170,151 +170,6 @@ func_dirname_and_basename ()
+ # Generated shell functions inserted here.
+-# These SED scripts presuppose an absolute path with a trailing slash.
+-pathcar="s,^/\([^/]*\).*$,\1,"
+-pathcdr="s,^/[^/]*,,"
+-removedotparts="s@/\(\./\)\{1,\}@/@g;s,/\.$,/,"
+-collapseslashes="s@/\{1,\}@/@g"
+-finalslash="s,/*$,/,"
+-
+-# func_normal_abspath PATH
+-# Remove doubled-up and trailing slashes, "." path components,
+-# and cancel out any ".." path components in PATH after making
+-# it an absolute path.
+-#             value returned in "$func_normal_abspath_result"
+-func_normal_abspath ()
+-{
+-  # Start from root dir and reassemble the path.
+-  func_normal_abspath_result=
+-  func_normal_abspath_tpath=$1
+-  func_normal_abspath_altnamespace=
+-  case $func_normal_abspath_tpath in
+-    "")
+-      # Empty path, that just means $cwd.
+-      func_stripname '' '/' "`pwd`"
+-      func_normal_abspath_result=$func_stripname_result
+-      return
+-    ;;
+-    # The next three entries are used to spot a run of precisely
+-    # two leading slashes without using negated character classes;
+-    # we take advantage of case's first-match behaviour.
+-    ///*)
+-      # Unusual form of absolute path, do nothing.
+-    ;;
+-    //*)
+-      # Not necessarily an ordinary path; POSIX reserves leading '//'
+-      # and for example Cygwin uses it to access remote file shares
+-      # over CIFS/SMB, so we conserve a leading double slash if found.
+-      func_normal_abspath_altnamespace=/
+-    ;;
+-    /*)
+-      # Absolute path, do nothing.
+-    ;;
+-    *)
+-      # Relative path, prepend $cwd.
+-      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+-    ;;
+-  esac
+-  # Cancel out all the simple stuff to save iterations.  We also want
+-  # the path to end with a slash for ease of parsing, so make sure
+-  # there is one (and only one) here.
+-  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+-        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+-  while :; do
+-    # Processed it all yet?
+-    if test "$func_normal_abspath_tpath" = / ; then
+-      # If we ascended to the root using ".." the result may be empty now.
+-      if test -z "$func_normal_abspath_result" ; then
+-        func_normal_abspath_result=/
+-      fi
+-      break
+-    fi
+-    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+-        -e "$pathcar"`
+-    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+-        -e "$pathcdr"`
+-    # Figure out what to do with it
+-    case $func_normal_abspath_tcomponent in
+-      "")
+-        # Trailing empty path component, ignore it.
+-      ;;
+-      ..)
+-        # Parent dir; strip last assembled component from result.
+-        func_dirname "$func_normal_abspath_result"
+-        func_normal_abspath_result=$func_dirname_result
+-      ;;
+-      *)
+-        # Actual path component, append it.
+-        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+-      ;;
+-    esac
+-  done
+-  # Restore leading double-slash if one was found on entry.
+-  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+-}
+-
+-# func_relative_path SRCDIR DSTDIR
+-# generates a relative path from SRCDIR to DSTDIR, with a trailing
+-# slash if non-empty, suitable for immediately appending a filename
+-# without needing to append a separator.
+-#             value returned in "$func_relative_path_result"
+-func_relative_path ()
+-{
+-  func_relative_path_result=
+-  func_normal_abspath "$1"
+-  func_relative_path_tlibdir=$func_normal_abspath_result
+-  func_normal_abspath "$2"
+-  func_relative_path_tbindir=$func_normal_abspath_result
+-
+-  # Ascend the tree starting from libdir
+-  while :; do
+-    # check if we have found a prefix of bindir
+-    case $func_relative_path_tbindir in
+-      $func_relative_path_tlibdir)
+-        # found an exact match
+-        func_relative_path_tcancelled=
+-        break
+-        ;;
+-      $func_relative_path_tlibdir*)
+-        # found a matching prefix
+-        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+-        func_relative_path_tcancelled=$func_stripname_result
+-        if test -z "$func_relative_path_result"; then
+-          func_relative_path_result=.
+-        fi
+-        break
+-        ;;
+-      *)
+-        func_dirname $func_relative_path_tlibdir
+-        func_relative_path_tlibdir=${func_dirname_result}
+-        if test "x$func_relative_path_tlibdir" = x ; then
+-          # Have to descend all the way to the root!
+-          func_relative_path_result=../$func_relative_path_result
+-          func_relative_path_tcancelled=$func_relative_path_tbindir
+-          break
+-        fi
+-        func_relative_path_result=../$func_relative_path_result
+-        ;;
+-    esac
+-  done
+-
+-  # Now calculate path; take care to avoid doubling-up slashes.
+-  func_stripname '' '/' "$func_relative_path_result"
+-  func_relative_path_result=$func_stripname_result
+-  func_stripname '/' '/' "$func_relative_path_tcancelled"
+-  if test "x$func_stripname_result" != x ; then
+-    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+-  fi
+-
+-  # Normalisation. If bindir is libdir, return empty string,
+-  # else relative path ending with a slash; either way, target
+-  # file name can be directly appended.
+-  if test ! -z "$func_relative_path_result"; then
+-    func_stripname './' '' "$func_relative_path_result/"
+-    func_relative_path_result=$func_stripname_result
+-  fi
+-}
+-
+ # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+ # is ksh but when the shell is invoked as "sh" and the current value of
+ # the _XPG environment variable is not equal to 1 (one), the special
+@@ -1703,8 +1558,6 @@ The following components of LINK-COMMAND
+   -all-static       do not do any dynamic linking at all
+   -avoid-version    do not add a version suffix if possible
+-  -bindir BINDIR    specify path to binaries directory (for systems where
+-                    libraries must be found in the PATH setting at runtime)
+   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+@@ -4219,7 +4072,6 @@ func_mode_link ()
+     new_inherited_linker_flags=
+     avoid_version=no
+-    bindir=
+     dlfiles=
+     dlprefiles=
+     dlself=no
+@@ -4312,11 +4164,6 @@ func_mode_link ()
+       esac
+       case $prev in
+-      bindir)
+-        bindir="$arg"
+-        prev=
+-        continue
+-        ;;
+       dlfiles|dlprefiles)
+         if test "$preload" = no; then
+           # Add the symbol object into the linking commands.
+@@ -4578,11 +4425,6 @@ func_mode_link ()
+       continue
+       ;;
+-      -bindir)
+-      prev=bindir
+-      continue
+-      ;;
+-
+       -dlopen)
+       prev=dlfiles
+       continue
+@@ -5570,8 +5412,14 @@ func_mode_link ()
+           absdir="$abs_ladir"
+           libdir="$abs_ladir"
+         else
+-          dir="$libdir"
+-          absdir="$libdir"
++          # Adding 'libdir' from the .la file to our library search paths
++          # breaks crosscompilation horribly.  We cheat here and don't add
++          # it, instead adding the path where we found the .la.  -CL
++          dir="$abs_ladir"
++          absdir="$abs_ladir"
++          libdir="$abs_ladir"
++          #dir="$libdir"
++          #absdir="$libdir"
+         fi
+         test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+       else
+@@ -5942,8 +5790,6 @@ func_mode_link ()
+               add="$libdir/$linklib"
+             fi
+           else
+-            # We cannot seem to hardcode it, guess we'll fake it.
+-            add_dir="-L$libdir"
+             # Try looking first in the location we're being installed to.
+             if test -n "$inst_prefix_dir"; then
+               case $libdir in
+@@ -6089,7 +5935,17 @@ func_mode_link ()
+                 fi
+                 ;;
+               *)
+-                path="-L$absdir/$objdir"
++                  # OE sets installed=no in staging. We need to look in $objdir and $absdir,
++                  # preferring $objdir. RP 31/04/2008
++                  if test -f "$absdir/$objdir/$depdepl" ; then
++                  depdepl="$absdir/$objdir/$depdepl"
++                  path="-L$absdir/$objdir"
++                  elif test -f "$absdir/$depdepl" ; then
++                  depdepl="$absdir/$depdepl"
++                  path="-L$absdir"
++                  else
++                  path="-L$absdir/$objdir"
++                  fi
+                 ;;
+               esac
+               else
+@@ -8279,27 +8135,9 @@ EOF
+         fi
+         $RM $output
+         # place dlname in correct position for cygwin
+-        # In fact, it would be nice if we could use this code for all target
+-        # systems that can't hard-code library paths into their executables
+-        # and that have no shared library path variable independent of PATH,
+-        # but it turns out we can't easily determine that from inspecting
+-        # libtool variables, so we have to hard-code the OSs to which it
+-        # applies here; at the moment, that means platforms that use the PE
+-        # object format with DLL files.  See the long comment at the top of
+-        # tests/bindir.at for full details.
+         tdlname=$dlname
+         case $host,$output,$installed,$module,$dlname in
+-          *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+-            # If a -bindir argument was supplied, place the dll there.
+-            if test "x$bindir" != x ;
+-            then
+-              func_relative_path "$install_libdir" "$bindir"
+-              tdlname=$func_relative_path_result$dlname
+-            else
+-              # Otherwise fall back on heuristic.
+-              tdlname=../bin/$dlname
+-            fi
+-            ;;
++          *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+         esac
+         $ECHO > $output "\
+ # $outputname - a libtool library file
+@@ -8579,3 +8417,4 @@ build_old_libs=`case $build_libtool_libs
+ # sh-indentation:2
+ # End:
+ # vi:sw=2
++
index a6b564f..2b235b9 100644 (file)
@@ -1,7 +1,7 @@
 require binutils.inc
 LICENSE = "GPLv3"
 
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
 
 SRC_URI = "\
      ${GNU_MIRROR}/binutils/binutils-${PV}.tar.bz2;name=tarball \
@@ -12,6 +12,7 @@ SRC_URI = "\
      file://binutils-uclibc-300-012_check_ldrunpath_length.patch \
      file://binutils-uclibc-gas-needs-libm.patch \
      file://binutils-x86_64_i386_biarch.patch \
+     file://libtool-update.patch \
      "
 
 SRC_URI[tarball.sha256sum] = "228b84722d87e88e7fdd36869e590e649ab523a0800a7d53df906498afe6f6f8"