Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 05 Jun 1998 14:32:49 +0800
From:      Peter Wemm <peter@netplex.com.au>
To:        =?koi8-r?B?4c7E0sXKIP7F0s7P1w==?= <ache@nagual.pp.ru>
Cc:        current@FreeBSD.ORG
Subject:   Re: lorder problem: aout vs. elf 
Message-ID:  <199806050632.OAA29086@spinner.netplex.com.au>
In-Reply-To: Your message of "Fri, 05 Jun 1998 09:46:28 %2B0400." <19980605094628.A1232@nagual.pp.ru> 

next in thread | previous in thread | raw e-mail | index | archive | help
=?koi8-r?B?4c7E0sXKIP7F0s7P1w==?= wrote:
> lorder.sh have hardcoded /usr/bin in PATH so can't find 'nm'
> 
> I see no easy way to determine aout / elf building system from shell
> script to find proper path for 'nm'

I have been using something along the lines of this:

Index: lorder.sh
===================================================================
RCS file: /home/ncvs/src/usr.bin/lorder/lorder.sh,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 lorder.sh
--- lorder.sh	1994/05/27 12:32:05	1.1.1.1
+++ lorder.sh	1998/06/05 06:22:06
@@ -37,6 +37,17 @@
 PATH=/bin:/usr/bin
 export PATH
 
+NMARGS=""
+
+if [ "x$1" = "x-elf" ]; then
+  NMARGS="-elf"
+  shift
+fi
+if [ "x$1" = "x-aout" ]; then
+  NMARGS="-aout"
+  shift
+fi
+
 # only one argument is a special case, just output the name twice
 case $# in
 	0)
@@ -62,7 +73,7 @@
 #
 # if the line has " U " it's a globally undefined symbol, put it into
 # the reference file.
-nm -go $* | sed "
+nm ${NMARGS} -go $* sed "
 	/:$/ {
 		s/://
 		s/.*/& &/

However, I am very with it and the other places where I've had to do this,
such as install.  I was considering a couple tweaks to the wrappers to do
auto detection of formats.  Things like size, nm, strip, strings, etc can
look at their files to see what format they are.

This was the nice thing about having the binutils stuff reading a.out, it 
didn't matter what sort of file a utility was give, it just worked.  (or 
didn't, as the case may be with the stale a.out binutils support.)

Cheers,
-Peter
--
Peter Wemm <peter@netplex.com.au>   Netplex Consulting



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806050632.OAA29086>