-/* $OpenBSD: elf.c,v 1.27 2015/04/09 04:46:18 guenther Exp $ */
+/* $OpenBSD: elf.c,v 1.28 2015/05/17 20:19:08 guenther Exp $ */
/*
* Copyright (c) 2003 Michael Shalayeff
stab = NULL;
*pnames = NULL; *psnames = NULL; *pnrawnames = 0;
- elf_symloadx(name, fp, foff, eh, shdr, shstr, pnames,
- psnames, pstabsize, pnrawnames, ELF_STRTAB, ELF_SYMTAB);
+ if (!dynamic_only) {
+ elf_symloadx(name, fp, foff, eh, shdr, shstr, pnames,
+ psnames, pstabsize, pnrawnames, ELF_STRTAB, ELF_SYMTAB);
+ }
if (stab == NULL) {
elf_symloadx(name, fp, foff, eh, shdr, shstr, pnames,
psnames, pstabsize, pnrawnames, ELF_DYNSTR, ELF_DYNSYM);
-.\" $OpenBSD: nm.1,v 1.26 2015/04/09 04:46:18 guenther Exp $
+.\" $OpenBSD: nm.1,v 1.27 2015/05/17 20:19:08 guenther Exp $
.\" $NetBSD: nm.1,v 1.3 1995/08/31 23:41:58 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\"
.\" @(#)nm.1 8.1 (Berkeley) 6/6/93
.\"
-.Dd $Mdocdate: April 9 2015 $
+.Dd $Mdocdate: May 17 2015 $
.Dt NM 1
.Os
.Sh NAME
.Nd display name list (symbol table)
.Sh SYNOPSIS
.Nm nm
-.Op Fl aCegnoprsuw
+.Op Fl aCDegnoprsuw
.Op Ar
.Sh DESCRIPTION
The symbol table (name list) of each object in
.It Fl C
Decode low-level symbol names.
This involves removing extra underscores and making C++ function names readable.
+.It Fl D
+Display the dynamic symbol table instead of the normal symbol table.
.It Fl e
Output extended information, that is `w' for weak symbols, `f' for
function-like symbols, and `o' for object-like symbols.
-/* $OpenBSD: nm.c,v 1.44 2015/04/09 04:46:18 guenther Exp $ */
+/* $OpenBSD: nm.c,v 1.45 2015/05/17 20:19:08 guenther Exp $ */
/* $NetBSD: nm.c,v 1.7 1996/01/14 23:04:03 pk Exp $ */
/*
int show_extensions;
int issize;
int usemmap = 1;
+int dynamic_only;
/* size vars */
unsigned long total_text, total_data, total_bss, total_total;
int show_file(int, int, const char *, FILE *fp, off_t, union hdr *);
void print_symbol(const char *, struct nlist *);
-#define OPTSTRING_NM "aABCegnoprsuvw"
+#define OPTSTRING_NM "aABCDegnoprsuvw"
const struct option longopts_nm[] = {
{ "debug-syms", no_argument, 0, 'a' },
{ "demangle", no_argument, 0, 'C' },
-/* { "dynamic", no_argument, 0, 'D' }, */
+ { "dynamic", no_argument, 0, 'D' },
{ "extern-only", no_argument, 0, 'g' },
/* { "line-numbers", no_argument, 0, 'l' }, */
{ "no-sort", no_argument, 0, 'p' },
case 'C':
demangle = 1;
break;
+ case 'D':
+ dynamic_only = 1;
+ break;
case 'e':
show_extensions = 1;
break;
-/* $OpenBSD: util.h,v 1.2 2004/10/09 22:11:11 millert Exp $ */
+/* $OpenBSD: util.h,v 1.3 2015/05/17 20:19:08 guenther Exp $ */
/*
* Placed in the public domain by Todd C. Miller <Todd.Miller@courtesan.com>
} while (0)
extern int usemmap;
+extern int dynamic_only;