gcc-4.8: fix compiling GCC when /usr/lib/libstdc++.so is present
authorJonathan Liu <net147@gmail.com>
Sun, 21 Jul 2013 10:07:42 +0000 (20:07 +1000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 29 Jul 2013 12:08:58 +0000 (13:08 +0100)
libtool is picking up libstdc++.so from /usr/lib when trying to link
libasan due to libstdc++.la containing libdir="/usr/lib". If compiling
for x86 and the host has 64-bit /usr/lib/libstdc++.so, the compilation
fails linking libasan with:
/usr/lib/libstdc++.so: could not read symbols: File in wrong format

To resolve this, patch libtool to look for the library in the path the
.la is contained in rather than use the libdir which usually points to
a host path.

[YOCTO #4879]

(From OE-Core rev: ec95dfeea1f17eb232563e105085852058a86c0b)

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/gcc/gcc-4.8.inc
meta/recipes-devtools/gcc/gcc-4.8/0041-libtool-avoid-libdir.patch [new file with mode: 0644]

index dafa241..42355f2 100644 (file)
@@ -70,6 +70,7 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
           file://0038-gcc-4.8-build-args.patch \
           file://0039-gcc-4.8-PR57717.patch \
           file://0040-fix-g++-sysroot.patch \
+          file://0041-libtool-avoid-libdir.patch \
          "
 SRC_URI[md5sum] = "3b2386c114cd74185aa3754b58a79304"
 SRC_URI[sha256sum] = "545b44be3ad9f2c4e90e6880f5c9d4f0a8f0e5f67e1ffb0d45da9fa01bb05813"
diff --git a/meta/recipes-devtools/gcc/gcc-4.8/0041-libtool-avoid-libdir.patch b/meta/recipes-devtools/gcc/gcc-4.8/0041-libtool-avoid-libdir.patch
new file mode 100644 (file)
index 0000000..2dd9610
--- /dev/null
@@ -0,0 +1,19 @@
+Avoid using libdir from .la which usually points to a host path
+
+Upstream-Status: Inappropriate [embedded specific]
+Signed-off-by: Jonathan Liu <net147@gmail.com>
+
+diff --git a/ltmain.sh b/ltmain.sh
+index a03433f..1902a90 100644
+--- a/ltmain.sh
++++ b/ltmain.sh
+@@ -5628,6 +5628,9 @@ func_mode_link ()
+           absdir="$abs_ladir"
+           libdir="$abs_ladir"
+         else
++          # Instead of using libdir from .la which usually points to a host path,
++          # use the path the .la is contained in.
++          libdir="$abs_ladir"
+           dir="$libdir"
+           absdir="$libdir"
+         fi