[PATCH] D75756: [llvm-objdump] Teach `llvm-objdump` dump dynamic symbols.

Xing via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 6 08:49:25 PST 2020


Higuoxing created this revision.
Higuoxing added reviewers: jhenderson, grimar, MaskRay.
Herald added subscribers: llvm-commits, rupprecht.
Herald added a project: LLVM.

This patch is to teach `llvm-objdump` dump dynamic symbols (`-T` and `--dynamic-syms`). Currently, this patch is not fully compatible with `gnu-objdump`, but I would like to continue working on this in next few patches. It has two issues.

1. Some symbols shouldn't be marked as global(g). (`-t/--syms` has same issue as well)
2. `gnu-objdump` can dump version information and *dynamically* insert before symbol name field. (I haven't been able to figure out how it works)

`objdump -T a.out` gives:

  DYNAMIC SYMBOL TABLE:
  0000000000000000  w   D  *UND*  0000000000000000              _ITM_deregisterTMCloneTable
  0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 printf
  0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 __libc_start_main
  0000000000000000  w   D  *UND*  0000000000000000              __gmon_start__
  0000000000000000  w   D  *UND*  0000000000000000              _ITM_registerTMCloneTable
  0000000000000000  w   DF *UND*  0000000000000000  GLIBC_2.2.5 __cxa_finalize

`llvm-objdump -T a.out` gives:

  DYNAMIC SYMBOL TABLE:
  0000000000000000  w   D  *UND*  0000000000000000 _ITM_deregisterTMCloneTable
  0000000000000000 g    DF *UND*  0000000000000000 printf
  0000000000000000 g    DF *UND*  0000000000000000 __libc_start_main
  0000000000000000  w   D  *UND*  0000000000000000 __gmon_start__
  0000000000000000  w   D  *UND*  0000000000000000 _ITM_registerTMCloneTable
  0000000000000000  w   DF *UND*  0000000000000000 __cxa_finalize


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75756

Files:
  llvm/test/tools/llvm-objdump/elf-dynamic-symbol.test
  llvm/tools/llvm-objdump/ELFDump.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-objdump/llvm-objdump.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75756.248754.patch
Type: text/x-patch
Size: 9881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200306/c7cfd8ea/attachment.bin>


More information about the llvm-commits mailing list