diff -urp elfutils-0.166.orig/src/nm.c elfutils-0.166/src/nm.c --- elfutils-0.166.orig/src/nm.c 2016-03-31 04:47:17.000000000 -0400 +++ elfutils-0.166/src/nm.c 2017-01-09 20:19:03.020321708 -0500 @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -1242,10 +1241,7 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehd size_t nentries = size / (entsize ?: 1); -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free - struct obstack whereob; - obstack_init (&whereob); + char* whereob = NULL; /* Get a DWARF debugging descriptor. It's no problem if this isn't possible. We just won't print any line number information. */ @@ -1405,12 +1401,10 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehd const char *file = dwarf_linesrc (line, NULL, NULL); file = (file != NULL) ? basename (file) : "???"; int n; - n = obstack_printf (&whereob, "%s:%d%c", file, - lineno, '\0'); - sym_mem[nentries_used].where - = obstack_finish (&whereob); + n = asprintf (&whereob, "%s:%d%c", file, lineno, '\0'); + sym_mem[nentries_used].where = whereob; - /* The return value of obstack_print included the + /* The return value of asprintf included the NUL byte, so subtract one. */ if (--n > (int) longest_where) longest_where = (size_t) n; @@ -1433,13 +1427,13 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehd if (found != NULL) { /* We found the line. */ - int n = obstack_printf (&whereob, "%s:%" PRIu64 "%c", + int n = asprintf (&whereob, "%s:%" PRIu64 "%c", basename ((*found)->file), (*found)->lineno, '\0'); - sym_mem[nentries_used].where = obstack_finish (&whereob); + sym_mem[nentries_used].where = whereob; - /* The return value of obstack_print included the + /* The return value of asprintf included the NUL byte, so subtract one. */ if (--n > (int) longest_where) longest_where = (size_t) n; @@ -1491,8 +1485,6 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehd if (nentries * sizeof (sym_mem[0]) >= MAX_STACK_ALLOC) free (sym_mem); - obstack_free (&whereob, NULL); - if (dbg != NULL) { tdestroy (global_root, free); Only in elfutils-0.166/src: nm.c~