This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: patch to fix nm.c(print_object_filename_bsd) on FreeBSD
Date: Wed, 19 Apr 2000 09:42:23 -0700
From: "David O'Brien" <obrien@FreeBSD.org>
On Tue, Apr 18, 2000 at 06:50:49PM -0700, Ian Lance Taylor wrote:
> This patch may be correct for all hosts. I'm not sure. The default
> output for nm should match that of the traditional BSD nm.
>
> I gather that what you are saying here is that nm -o, if invoked with
> multiple files, should print the filename on a separate line as well
> as printing it on the line with every symbol.
This is the snipit of lorder.sh that depended on the tradional behavior:
[I've converted the CSRG s.lorder.sh file to an RCS file for easier use]
revision 5.2
date: 1990/03/20 16:28:56; author: bostic; state: Exp; lines: +56 -27
redo from scratch, needed to support '.po' suffixes
nm -go $* | sed "
/:$/ {
s/://
s/.*/& &/
p
d
}
Hmmm. I just looked at the NetBSD lorder script, and it looks like
this:
(for file in $* ; do echo $file":" ; done ; $NM -go $*) >$N
sed -ne '/:$/{s/://;s/.*/& &/;p;}' <$N
sed -ne 's/:.* [TDGR] / /p' <$N >$S
sed -ne 's/:.* U / /p' <$N >$R
According to cvsweb.netbsd.org, looping through files like that was
added in 1997.
Michael Sokolov reports that nm -go on BSD4.3 doesn't print the file
name separately, and I just confirmed that on SunOS as well. So it
sounds like the BSD nm changed behaviour at some point. I don't know
when, though.
I'm not sure what the best choice is here. I'm not strongly inclined
to change the GNU nm behaviour.
Ian