diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-01-17 12:40:45 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-01-17 12:40:45 +0100 |
commit | 3e45412327a2654a77944249962b3652e6142299 (patch) | |
tree | bc3bf69452afa055423cbe0c5cfa8ca357df6ccf /src/cmd/nm | |
parent | c533680039762cacbc37db8dc7eed074c3e497be (diff) | |
download | golang-upstream/2011.01.12.tar.gz |
Imported Upstream version 2011.01.12upstream/2011.01.12
Diffstat (limited to 'src/cmd/nm')
-rw-r--r-- | src/cmd/nm/Makefile | 18 | ||||
-rw-r--r-- | src/cmd/nm/nm.c | 17 |
2 files changed, 16 insertions, 19 deletions
diff --git a/src/cmd/nm/Makefile b/src/cmd/nm/Makefile index bb1545122..383dbd973 100644 --- a/src/cmd/nm/Makefile +++ b/src/cmd/nm/Makefile @@ -2,23 +2,17 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -include ../../Make.conf +include ../../Make.inc +O:=$(HOST_O) # The directory is nm because the source is portable and general. -# We call the binary 6nm to avoid confusion and because this binary -# is linked only with amd64 and x86 support. +# We call the binary 6nm to avoid confusion with the host nm. TARG=6nm OFILES=\ nm.$O\ -$(TARG): $(OFILES) - $(LD) -o $(TARG) -L"$(GOROOT)"/lib $(OFILES) -lmach -lbio -l9 +LIB=\ + ../../../lib/libmach.a\ -clean: - rm -f *.$O $(TARG) - -install: $(TARG) - cp $(TARG) "$(GOBIN)"/$(TARG) - -$(OFILES): $(HFILES) +include ../../Make.ccmd diff --git a/src/cmd/nm/nm.c b/src/cmd/nm/nm.c index 978218bff..845b6c773 100644 --- a/src/cmd/nm/nm.c +++ b/src/cmd/nm/nm.c @@ -126,31 +126,34 @@ void doar(Biobuf *bp) { int offset, size, obj; - char membername[SARNAME]; + char name[SARNAME]; multifile = 1; for (offset = Boffset(bp);;offset += size) { - size = nextar(bp, offset, membername); + size = nextar(bp, offset, name); if (size < 0) { - error("phase error on ar header %ld", offset); + error("phase error on ar header %d", offset); return; } if (size == 0) return; - if (strcmp(membername, symname) == 0) + if (strcmp(name, symname) == 0) continue; obj = objtype(bp, 0); if (obj < 0) { + // perhaps foreign object + if(strlen(name) > 2 && strcmp(name+strlen(name)-2, ".o") == 0) + return; error("inconsistent file %s in %s", - membername, filename); + name, filename); return; } if (!readar(bp, obj, offset+size, 1)) { error("invalid symbol reference in file %s", - membername); + name); return; } - filename = membername; + filename = name; nsym=0; objtraverse(psym, 0); printsyms(symptr, nsym); |