libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] libtool: LT_PATH_NM: default to ${ac_tool_prefix}nm


From: Mike Frysinger
Subject: [PATCH] libtool: LT_PATH_NM: default to ${ac_tool_prefix}nm
Date: Sat, 27 Apr 2013 01:58:42 -0400

The current code tries to locate a compatible nm tool.  It starts with
a prefixed nm tool (great!) and includes a plain nm too (that's fine).
The problem is that the code searches for the prefixed nm before the
plain nm (normally fine), but doesn't break once it has found a valid
match.  It does this so that it if it finds an "OK", but "not great",
tool, it'll keep on searching.

Let's re-order the search so that the plain nm comes first and the
prefixed nm comes last.  This doesn't violate any of the existing
logic and keeps us with defaulting to the prefixed tool.

The code currently tries to avoid using a plain nm tool when it knows
it most likely will be wrong (i.e. when cross-compiling).  However,
this assumption is not valid and can indeed cause problems.  Consider
projects that utilize qemu to provide "native" builds all the time:
$ ./config.guess
x86_64-unknown-linux-gnu
$ ./configure --build=bfin-uclinux --host=bfin-uclinux
The code produced by the toolchain will execute fine here (because
we've configured the system to use qemu to transparently run the
programs), but libtool will end up defaulting to `nm` which does not
work with ELFs it does not know about.

* m4/libtool.m4 (LT_PATH_NM): Prepend nm to lt_nm_to_check rather than
append.

Signed-off-by: Mike Frysinger <address@hidden>
---
 m4/libtool.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 3f50b0c..624b3a0 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -3381,7 +3381,7 @@ AC_CACHE_CHECK([for BSD- or MS-compatible name lister 
(nm)], lt_cv_path_NM,
 else
   lt_nm_to_check=${ac_tool_prefix}nm
   if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
-    lt_nm_to_check="$lt_nm_to_check nm"
+    lt_nm_to_check="nm $lt_nm_to_check"
   fi
   for lt_tmp_nm in $lt_nm_to_check; do
     lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
-- 
1.8.2.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]