This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Use $(NM) not nm in tst-cancel-wrappers


On Fri, 19 Oct 2012, Carlos O'Donell wrote:

> On Fri, Oct 19, 2012 at 8:29 AM, Joseph S. Myers
> <joseph@codesourcery.com> wrote:
> > On Thu, 18 Oct 2012, Carlos O'Donell wrote:
> >
> >> I would rather this variable be called something other
> >> than nm, such that it clearly fails if the "$" is left
> >> off by accident.
> >
> > I don't think the "$" being left off by accident is a significantly more
> > plausible mistake than anything else someone might do wrong when editing
> > this script.
> 
> Is there any down side to calling the variable NM following what's
> used in the configure scripts?
> 
> It makes it easier to search for occurrences of NM, and accidental
> removal of $ doesn't result in a script that works on native only.

There isn't a specific downside, but I don't think there's any benefit 
either.  However, here is a patch version that uses NM for the variable 
name.  Tested x86_64.

2012-10-19  Jim Blandy  <jimb@codesourcery.com>
	    Joseph Myers  <joseph@codesourcery.com>

	* config.make.in (NM): New variable.

nptl:
2012-10-19  Jim Blandy  <jimb@codesourcery.com>
	    Joseph Myers  <joseph@codesourcery.com>

	* Makefile ($(objpfx)tst-cancel-wrappers.out): Pass $(NM) to
	tst-cancel-wrappers.sh.
	* tst-cancel-wrappers.sh: Use nm program given as first argument,
	not hardcoded "nm".

diff --git a/config.make.in b/config.make.in
index b6d1c94..c22acf4 100644
--- a/config.make.in
+++ b/config.make.in
@@ -111,6 +111,7 @@ CPPFLAGS-config = @CPPFLAGS@
 CPPUNDEFS = @CPPUNDEFS@
 ASFLAGS-config = @ASFLAGS_config@
 AR = @AR@
+NM = @NM@
 MAKEINFO = @MAKEINFO@
 AS = $(CC) -c
 MIG = @MIG@
diff --git a/nptl/Makefile b/nptl/Makefile
index 184057b..bc563f8 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -587,7 +587,8 @@ ifeq (no,$(cross-compiling))
 ifeq (yes,$(build-shared))
 tests: $(objpfx)tst-cancel-wrappers.out
 $(objpfx)tst-cancel-wrappers.out: tst-cancel-wrappers.sh
-	$(SHELL) $< $(common-objpfx)libc_pic.a \
+	$(SHELL) $< '$(NM)' \
+		    $(common-objpfx)libc_pic.a \
 		    $(common-objpfx)libc.a \
 		    $(objpfx)libpthread_pic.a \
 		    $(objpfx)libpthread.a > $@
diff --git a/nptl/tst-cancel-wrappers.sh b/nptl/tst-cancel-wrappers.sh
index dad2a67..b16ab2f 100644
--- a/nptl/tst-cancel-wrappers.sh
+++ b/nptl/tst-cancel-wrappers.sh
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Test whether all cancelable functions are cancelable.
-# Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
 
@@ -18,8 +18,9 @@
 # License along with the GNU C Library; if not, see
 # <http://www.gnu.org/licenses/>.
 
+NM="$1"; shift
 while [ $# -gt 0 ]; do
-  ( nm -P $1; echo 'end[end]:' ) | gawk ' BEGIN {
+  ( $NM -P $1; echo 'end[end]:' ) | gawk ' BEGIN {
 C["accept"]=1
 C["close"]=1
 C["connect"]=1

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]