diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2013-03-30 21:26:10 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2013-03-30 21:26:10 +0000 |
commit | 3a1c4a6b68d8081dc9d6349835d9272123b867b7 (patch) | |
tree | c8fecdf16e1a9175b2d649c9cd17312d5850677d /usr.bin | |
parent | c7cf70f5faea4b6f43ddd0bbee4ee0a4a425f65a (diff) |
Correctly report `weak' status of non-function symbols. Makes nm agree with
objdump -t on, say, _DYNAMIC in libpthread.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/nm/elf.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/nm/elf.c b/usr.bin/nm/elf.c index e81a421f539..d279e96f577 100644 --- a/usr.bin/nm/elf.c +++ b/usr.bin/nm/elf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elf.c,v 1.20 2011/09/28 19:58:14 uwe Exp $ */ +/* $OpenBSD: elf.c,v 1.21 2013/03/30 21:26:09 miod Exp $ */ /* * Copyright (c) 2003 Michael Shalayeff @@ -341,8 +341,9 @@ elf2nlist(Elf_Sym *sym, Elf_Ehdr *eh, Elf_Shdr *shdr, char *shstr, struct nlist #if 0 { extern char *stab; - printf("%d:%s %d %s\n", sym->st_shndx, sn? sn : "", - ELF_ST_TYPE(sym->st_info), stab + sym->st_name); + printf("%d:%s %d %d %s\n", sym->st_shndx, sn? sn : "", + ELF_ST_TYPE(sym->st_info), ELF_ST_BIND(sym->st_info), + stab + sym->st_name); } #endif @@ -364,6 +365,8 @@ elf2nlist(Elf_Sym *sym, Elf_Ehdr *eh, Elf_Shdr *shdr, char *shstr, struct nlist } else np->n_type = type; } + if (ELF_ST_BIND(sym->st_info) == STB_WEAK) + np->n_other = 'W'; break; case STT_FUNC: |