summaryrefslogtreecommitdiffstats
path: root/src/nm.c
Commit message (Collapse)AuthorAgeFilesLines
* Move print_version into printversion.{h|c}Ulf Hermann2017-02-171-0/+1
| | | | | | | | Rename version.c so that the implementation is called after the header and the header doesn't clash with the toplevel version.h. print_version depends on argp and is only used in the tools. Signed-off-by: Ulf Hermann <[email protected]>
* Move color handling into a separate headerUlf Hermann2017-02-151-0/+1
| | | | | | | | We only need it in nm.c and objdump.c, but it pulls in argp as dependency. By dropping it from libeu.h, the libraries can be compiled without argp. Signed-off-by: Ulf Hermann <[email protected]>
* http://elfutils.org/ is now hosted at http://sourceware.org/elfutils/Mark Wielaard2016-12-241-15/+0
| | | | | | | | | | | | | | | | | fedorahosted used to be our home, but we are now hosted at sourceware. Change the elfutils project home to http://elfutils.org/ Point hosted services (email, release, git, bug tracker and web pages) to https://sourceware.org/elfutils/ Move design notes from README to NOTES. Add URLs for home, releases, bugs, git and mailinglist to README. Make the --version output of all tools the same by using a common print_version function and update the publicly shown copyright holder to the elfutils developers. Signed-off-by: Mark Wielaard <[email protected]>
* lib: Provide MAX and MIN in system.hAkihiko Odaki2016-10-121-1/+1
| | | | | | | | | | This change also creates a new header file libeu.h to provide the prototypes for the function of libeu. That hides the definition of function crc32, which can conflict with zlib, from libelf. It also prevents mistakes to refer those functions from a component which doesn't link with libeu, such as libelf. Signed-off-by: Akihiko Odaki <[email protected]>
* nm: Check for malloc size argument overflow in show_symbols.Mark Wielaard2016-03-211-0/+5
| | | | | Reported-by: Florian Weimer <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* nm: If the file is ET_REL and we need Dwarf use libdwfl to get it relocated.Mark Wielaard2016-01-021-8/+106
| | | | | | | | | | | If we need Dwarf and the file is ET_REL use the same trick as in readelf to get a relocated Dwarf. Otherwise lots of references in the debug_info will come out as zero. This also explains the "bogus" Dwarf seen that caused the memory leak in the local_root that was fixed previously. Signed-off-by: Mark Wielaard <[email protected]>
* nm: Don't leak duplicate Dwarf local names.Mark Wielaard2016-01-021-5/+10
| | | | | | | Badly formed DWARF can have duplicate local names. In which case we do want to detect those so we don't leak the memory. Signed-off-by: Mark Wielaard <[email protected]>
* nm: First call elf_getdata, then allocate memory.Mark Wielaard2015-06-271-6/+6
| | | | | | | | This catches bogus data early before we might try to allocate giant amounts of memory. Reported-by: Hanno Böck <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* nm: Fix typo in size check to determine whether we stack allocated memory.Mark Wielaard2015-06-191-1/+1
| | | | | | | | | We allocate GElf_SymX entries, which are larger than plain GElf_Sym structs. The check to see whether we could use stack allocation used the correct sizeof (GElf_SymX), but the check to see if we needed to free was using the incorrect sizeof (GElf_Sym). Which could cause us to leak memory. Signed-off-by: Mark Wielaard <[email protected]>
* Always call gelf_fsize with EV_CURRENT as argument.Mark Wielaard2015-05-131-1/+1
| | | | | | | | | | Don't trust the elf version given by the file. It could be completely bogus. In which case gelf_fsize just returns zero. Which could cause divide by zero errors. https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c34 Signed-off-by: Mark Wielaard <[email protected]>
* nm: Handle dwarf_linesrc returning NULL.Mark Wielaard2015-05-121-4/+3
| | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1170810#32 Signed-off-by: Mark Wielaard <[email protected]>
* Drop mtrace calls.Max Filippov2015-05-041-4/+0
| | | | | | | mtrace is a GNU extension not supported by uClibc and it's believed to not be really used. Drop mtrace() calls and #include <mcheck.h>. Signed-off-by: Max Filippov <[email protected]>
* src: Remove __DATE__ from internal error messages.Mark Wielaard2015-04-141-3/+3
| | | | | | | The date didn't really add much information (it is the day on which the code happened to be compiled) and it prevents creating reproducible builds. Signed-off-by: Mark Wielaard <[email protected]>
* nm: Guard against divide by zero in error check.Mark Wielaard2015-01-121-5/+8
| | | | | | | | | Also add section index number in error message. https://bugzilla.redhat.com/show_bug.cgi?id=1170810 Reported-by: Alexander Cherepanov <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* nm: Handle/Skip /SYM64/ index entries.Mark Wielaard2015-01-121-1/+2
| | | | | | Add a testcase to show eu-nm now handles archives with 64-bit symbol table. Signed-off-by: Mark Wielaard <[email protected]>
* nm: Stop processing ar members on first invalid offset.Mark Wielaard2015-01-121-1/+1
| | | | | | | | | Otherwise we will keep looping on that same invalid entry. https://bugzilla.redhat.com/show_bug.cgi?id=1170810 Reported-by: Alexander Cherepanov <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* Use -Wformat=2 by default for all files.Mark Wielaard2014-01-301-44/+49
| | | | | | | | This just makes sure that all format strings are given as literals to printf like functions so the compiler can see and check them. Remove all no_Wformat, add -Wformat=2 unconditionally to AM_CFLAGS. Signed-off-by: Mark Wielaard <[email protected]>
* Fix corruption of non-C++ symbols by the demangler.Jan Kratochvil2014-01-151-8/+8
| | | | Signed-off-by: Jan Kratochvil <[email protected]>
* Fix some (harmless) cppcheck warnings.Mark Wielaard2013-11-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | [dwarf_getaranges.c:149]: (warning) Ineffective statement similar to '*A++;'. Did you intend to write '(*A)++;'? There was already an XXX statement that we weren't using the result. Explicitly read the segment_size and check it is zero. And report an error if it isn't, since we aren't prepared to handle such a case. [arlib.c:62]: (error) Uninitialized variable: tmpbuf [arlib.c:124]: (error) Uninitialized variable: tmpbuf cppcheck is wrong. tmpbuf is initialized in the snprintf call whose result is use in the same memcpy call. It does make the code less readable and harder to understand. So explicitly split the snprintf and memcpy calls. [nm.c:766]: (warning) Assert statement modifies 'cnt'. The cnt variable was only used for this assert sanity check. But it is bad style to do have side effects inside an assert statement. Increase cnt after the assert. Reported-by: David Binderman <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* Add missing semicolon in show_symbols_sysvMark Wielaard2012-12-111-1/+1
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* nm: Fix size passed to snprintf for invalid sh_name case.Roland McGrath2012-12-111-2/+3
| | | | Signed-off-by: Roland McGrath <[email protected]>
* Reorder formatting string arguments so that there are no gaps in referencesPetr Machata2012-07-301-8/+8
| | | | | | | It is required that formatting string that uses $-style references lists all arguments. Signed-off-by: Petr Machata <[email protected]>
* Update name, license and contributor policy.Mark Wielaard2012-06-051-19/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change name from "Red Hat elfutils" to "elfutils". * Update license of standalone tools and test from GPLv2 to GPLv3+. * Change license of libraries from GPLv2+exception to GPLv2/LGPLv3+. * Add Developer Certificate of Origin based contributor policy. top-level: - COPYING: Upgraded from GPLv2 to GPLv3. - CONTRIBUTING, COPYING-GPLv2, COPYING-LGPLv3: New files. - NEWS: Added note about new contribution and license policy. - Makefile.am: Updated to GPLv3, added new files to EXTRA_DIST. - configure.ac: Update to GPLv3, changed AC_INIT name to 'elfutils'. backends, lib, libasm, libcpu, libdw, libdwfl, libebl, libelf: - All files updated to GPLv2/LGPLv3+. Except some very small files (<5 lines) which didn't have any headers at all before, the linker .maps files and the libcpu/defs files which only contain data and libelf/elf.h which comes from glibc and is under LGPLv2+. config: - elfutils.spec.in: Add new License: headers and new %doc files. - Update all license headers to GPLv2/LGPLv3+ for files used by libs. src, tests: - All files updated to GPLv3+. Except for the test bz2 data files, the linker maps and script files and some very small files (<5 lines) that don't have any headers. Signed-off-by: Richard Fontana <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* Update copyright yearUlrich Drepper2012-01-211-2/+2
|
* Color code output of nm and objdumpUlrich Drepper2012-01-211-29/+65
|
* Fix nm output for sysv formatUlrich Drepper2011-10-031-9/+25
| | | | | Undefined symbols need no address and siz printed. Avoid the initial entry which is no real symbol. Avoid section symbols.
* Improve nm output for BSD and POSIX formatUlrich Drepper2011-10-031-26/+59
| | | | | | | | | The binutils version showed more information since it distinguished unique symbols, symbols in read-only and bss sections. The format is now the same. In addition handle TLS symbols correctly but differently from binutils nm since the latter drops information. Instead use a @ suffix to indicate TLS similar to * to indicate weak.
* Add demangling support to nmUlrich Drepper2011-10-021-3/+104
|
* nm.c: Remove unused if/else and parameters.Marek Polacek2011-05-121-9/+4
|
* Add aliases for elf_getshnum and elf_getshstrndx.Ulrich Drepper2009-06-131-3/+3
| | | | | | | | | | Sun in their implementation messed up the semantics of these functions. To get back to source code compatibility they asked for a solution. We simply add aliases for the two affected functions, named elf_getshdrnum and elf_getshdrstrndx. The semantics remains the same. Users of the old interfaces receive a warning for now. In future we might make it impossible to link programs which request the old interfaces (binary compatibility will of course be maintained).
* Move argp_program_version_hook and argp_program_bug_address variablesUlrich Drepper2009-01-171-2/+2
| | | | in all programs into the .rodata section.
* Unpdate copyright in messages.Ulrich Drepper2009-01-011-2/+2
|
* Fix crashes on bad sh_name/st_name offsets.Roland McGrath2008-12-111-10/+36
|
* propagate from branch 'com.redhat.elfutils.disasm' (head ↵Ulrich Drepper2008-01-021-0/+3
| | | | | | d15b4eb794e81e477f9896fe82a74cb5ecf4514c) to branch 'com.redhat.elfutils' (head eaacbf01f8cc89d043ec6eca9b5e35cb5c4cde06)
* Update copyright year.Ulrich Drepper2008-01-021-1/+1
|
* readelf register printing sort order tweakRoland McGrath2007-08-231-22/+31
|
* Prepare for 0.128 release.Ulrich Drepper2007-06-061-4/+4
| | | | | | Minor fixes. Update gettext files to 0.16.1.
* Update copyright year.elfutils-0.125Ulrich Drepper2007-01-101-2/+2
|
* Fix FSF address. No exception for libdwarf.Ulrich Drepper2006-04-041-1/+1
|
* Prepare for 0.120 release.Ulrich Drepper2006-04-041-2/+2
|
* propagate from branch 'com.redhat.elfutils.roland.pending' (head ↵Ulrich Drepper2006-04-041-9/+21
| | | | | | 4f8fc821345feef58624f0aa5b470d4827577d8c) to branch 'com.redhat.elfutils' (head 76e26cb54695fd3b21ee8fb5be3036bd68200633)
* NEWS updatesRoland McGrath2005-10-281-2/+2
|
* Some more message unifications.Ulrich Drepper2005-09-031-2/+2
|
* 2005-08-23 Roland McGrath <[email protected]>Roland McGrath2005-08-231-7/+0
| | | | | | * dwarf_attr_integrate.c (dwarf_attr_integrate): Treat DW_AT_specification the same as DW_AT_abstract_origin.
* Adjust for monotone.Ulrich Drepper2005-07-261-0/+1282