A user was trying to build the buildroot product for mips64 with the -mabi=64
option and ran into a libtool problem when building libiscsi because it calls
the linker via libtool and the linker was defaulting to the n32 ABI instead of
the 64 bit ABI.  This patch to libtool.m4 checks for the correct ABI to use
like IA64, AIX, and other platforms already do and passes the correct emulation
mode into the linker.

I am hoping someone can review this patch and check it in to libtool, though
the list appears very quiet lately.

Steve Ellcey
sell...@mips.com


diff --git a/m4/libtool.m4 b/m4/libtool.m4
index d7013c5..c9465ee 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1307,6 +1307,36 @@ ia64-*-hpux*)
   rm -rf conftest*
   ;;
 
+mips64*-*linux*)
+  # Find out which ABI we are using.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    emul="elf"
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+       emul="${emul}32"
+       ;;
+      *64-bit*)
+       emul="${emul}64"
+       ;;
+    esac
+    case `/usr/bin/file conftest.o` in
+      *MSB*)
+       emul="${emul}btsmip"
+       ;;
+      *LSB*)
+       emul="${emul}ltsmip"
+       ;;
+    esac
+    case `/usr/bin/file conftest.o` in
+      *N32*)
+       emul="${emul}n32"
+       ;;
+    esac
+    LD="${LD} -m ${emul}"
+  fi
+  ;;
+
 x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # Find out which ABI we are using.


Reply via email to