mirror of
https://github.com/openbsd/src.git
synced 2025-01-03 06:45:37 -08:00
ELF weak symbols are _not_ like a.out indirect symbols. Nothing in ELF is,
so remove N_INDR handling. ok kettenis@
This commit is contained in:
parent
a7f0b6ad71
commit
2c739b87c6
@ -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) &&
|
||||
|
@ -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.
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user