diff --git a/ChangeLog b/ChangeLog
index 9a46dca69f4daea2370f0691dff60c481260108d..a50fa6793bffbca902bcd9c1871986831b55f3c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	Merge upstream change
+	* libtool.m4 (_LT_ENABLE_LOCK): Support x32.
+
 2012-05-14  Marc Glisse  <marc.glisse@inria.fr>
 
 	* MAINTAINERS (Write After Approval): Add myself.
diff --git a/libtool.m4 b/libtool.m4
index 67321a7d07009ad075b394bc2d12777093fefaa7..a7f99ac7dbc00efaf042713bb13714099b360991 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1232,7 +1232,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	    LD="${LD-ld} -m elf_i386_fbsd"
 	    ;;
 	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_i386"
+	    case `/usr/bin/file conftest.o` in
+	      *x86-64*)
+		LD="${LD-ld} -m elf32_x86_64"
+		;;
+	      *)
+		LD="${LD-ld} -m elf_i386"
+		;;
+	    esac
 	    ;;
 	  ppc64-*linux*|powerpc64-*linux*)
 	    LD="${LD-ld} -m elf32ppclinux"