[llvm-commits] [PATCH] utils/GenLibDeps.pl

Edward O'Callaghan eocallaghan at auroraux.org
Wed Jun 10 17:23:21 PDT 2009


Hi,

Another small one from me.

* This patch is intended to provide support for exporting a "NM"
environment variable for a new `nm` PATH for whatever reason, such as
I needed to export a GNU version while on Solaris until I did the
second part of this patch which I need a second view on just in case.
* Fix the SUS usage of `nm` on Unix platforms such as Solaris or
AuroraUX; -u is undefined symbols, and says "those external to each
object file" so using -g would seem redundant, The error message was
as follows: "/usr/xpg4/bin/nm: -e or -g set, -u ignored".

$ diff -u utils/GenLibDeps.pl ../GenLibDeps.pl
--- utils/GenLibDeps.pl Wed Jun 10 19:15:17 2009
+++ ../GenLibDeps.pl    Thu Jun 11 01:14:59 2009
@@ -38,6 +38,10 @@
   die "Can't find 'dot'" if (! -x "$DotPath");
 }

+if (defined($ENV{NM})) {
+  chomp($nmPath=$ENV{NM});
+}
+
 if (!defined($nmPath) || $nmPath eq "") {
   chomp($nmPath=`which nm`);
   die "Can't find 'nm'" if (! -x "$nmPath");
@@ -96,7 +100,7 @@
     print "  <dt><b>$lib</b</dt><dd><ul>\n";
   }
   open UNDEFS,
-    "$nmPath -g -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort | uniq |";
+    "$nmPath -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort | uniq |";
   my %DepLibs;
   while (<UNDEFS>) {
     chomp;
@@ -116,7 +120,7 @@
   close UNDEFS or die "nm failed";
   unless(keys %DepLibs) {
     # above failed
-    open UNDEFS, "$nmPath -g -u $Directory/$lib |";
+    open UNDEFS, "$nmPath -u $Directory/$lib |";
     while (<UNDEFS>) {
       # to bypass non-working sed
       if ('  ' eq substr($_,0,2) and index($_,'U ')) {

Cheers,
Edward.

-- 
-- 
Edward O'Callaghan
http://www.auroraux.org/
eocallaghan at auroraux dot org



More information about the llvm-commits mailing list