From: guenther Date: Thu, 9 Apr 2015 04:46:18 +0000 (+0000) Subject: ELF weak symbols are _not_ like a.out indirect symbols. Nothing in ELF is, X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2c739b87c6e85d71bf605f818e970c9c53db2a12;p=openbsd ELF weak symbols are _not_ like a.out indirect symbols. Nothing in ELF is, so remove N_INDR handling. ok kettenis@ --- diff --git a/usr.bin/nm/elf.c b/usr.bin/nm/elf.c index 4cc20617983..9599b7ec4a2 100644 --- a/usr.bin/nm/elf.c +++ b/usr.bin/nm/elf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elf.c,v 1.26 2015/02/06 23:21:59 millert Exp $ */ +/* $OpenBSD: elf.c,v 1.27 2015/04/09 04:46:18 guenther Exp $ */ /* * Copyright (c) 2003 Michael Shalayeff @@ -376,7 +376,6 @@ elf2nlist(Elf_Sym *sym, Elf_Ehdr *eh, Elf_Shdr *shdr, char *shstr, struct nlist type = elf_shn2type(eh, sym->st_shndx, NULL); np->n_type = type < 0? N_TEXT : type; if (ELF_ST_BIND(sym->st_info) == STB_WEAK) { - np->n_type = N_INDR; np->n_other = 'W'; } else if (sn != NULL && *sn != 0 && strcmp(sn, ELF_INIT) && diff --git a/usr.bin/nm/nm.1 b/usr.bin/nm/nm.1 index 80c6fa41f7c..572342ff62c 100644 --- a/usr.bin/nm/nm.1 +++ b/usr.bin/nm/nm.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: nm.1,v 1.25 2014/04/09 21:56:26 jmc Exp $ +.\" $OpenBSD: nm.1,v 1.26 2015/04/09 04:46:18 guenther Exp $ .\" $NetBSD: nm.1,v 1.3 1995/08/31 23:41:58 jtc Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)nm.1 8.1 (Berkeley) 6/6/93 .\" -.Dd $Mdocdate: April 9 2014 $ +.Dd $Mdocdate: April 9 2015 $ .Dt NM 1 .Os .Sh NAME @@ -104,8 +104,6 @@ bss or tbss segment symbol common symbol .It Li D data or tdata segment symbol -.It Li I -indirect reference (alias to other symbol) .It Li F file name .It Li R @@ -115,7 +113,7 @@ text segment symbol .It Li U undefined .It Li W -weak symbol (only on ELF binaries) +weak symbol .El .Pp If the symbol is local (non-external), the type letter is in lower case. diff --git a/usr.bin/nm/nm.c b/usr.bin/nm/nm.c index 68ff1d35764..fd49c022f01 100644 --- a/usr.bin/nm/nm.c +++ b/usr.bin/nm/nm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nm.c,v 1.43 2015/04/08 04:23:15 guenther Exp $ */ +/* $OpenBSD: nm.c,v 1.44 2015/04/09 04:46:18 guenther Exp $ */ /* $NetBSD: nm.c,v 1.7 1996/01/14 23:04:03 pk Exp $ */ /* @@ -710,12 +710,8 @@ show_file(int count, int warn_fmt, const char *name, FILE *fp, off_t foff, union (void)printf("\n%s:\n", name); /* print out symbols */ - for (i = 0; i < nnames; i++) { - if (show_extensions && snames[i] != names && - SYMBOL_TYPE((snames[i] -1)->n_type) == N_INDR) - continue; + for (i = 0; i < nnames; i++) print_symbol(name, snames[i]); - } free(snames); free(names); @@ -745,9 +741,7 @@ print_symbol(const char *name, struct nlist *sym) */ if (!print_only_undefined_symbols) { /* print symbol's value */ - if (SYMBOL_TYPE(sym->n_type) == N_UNDF || - (show_extensions && SYMBOL_TYPE(sym->n_type) == N_INDR && - sym->n_value == 0)) + if (SYMBOL_TYPE(sym->n_type) == N_UNDF) (void)printf(" "); else (void)printf("%08lx", sym->n_value); @@ -759,10 +753,7 @@ print_symbol(const char *name, struct nlist *sym) (void)printf(" %c ", typeletter(sym)); } - if (SYMBOL_TYPE(sym->n_type) == N_INDR && show_extensions) - printf("%s -> %s\n", symname(sym), symname(sym+1)); - else - (void)puts(symname(sym)); + (void)puts(symname(sym)); } /* @@ -796,8 +787,6 @@ typeletter(struct nlist *np) return(ext? 'F' : 'W'); case N_TEXT: return(ext? 'T' : 't'); - case N_INDR: - return(ext? 'I' : 'i'); case N_SIZE: return(ext? 'S' : 's'); case N_UNDF: