llvm-objdump does not give information about all relocations


We are trying to use LLVM API to programmatically obtain a list of
relocations in an ELF file. The way we are doing this is exactly as
llvm-objdump does it: we are iterating through sections and in each
section we are iterating over relocations (see PrintRelocations()
function at https://llvm.org/svn/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp).
However, it does not give us relocation entries in .rela.dyn section.

Consider, for instance, the output of "readelf -r /bin/true":

$ readelf -r /bin/true

Relocation section '.rela.dyn' at offset 0xa80 contains 5 entries:
  Offset Info Type Sym. Value Sym. Name + Addend
000000604c38 001800000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0
000000604de0 002800000005 R_X86_64_COPY 0000000000604de0 __progname + 0
000000604df0 002700000005 R_X86_64_COPY 0000000000604df0 stdout + 0
000000604e00 002a00000005 R_X86_64_COPY 0000000000604e00
__progname_full + 0
000000604e08 002c00000005 R_X86_64_COPY 0000000000604e08 stderr + 0

Relocation section '.rela.plt' at offset 0xaf8 contains 37 entries:
  Offset Info Type Sym. Value Sym. Name + Addend
000000604c60 000100000007 R_X86_64_JUMP_SLO 0000000000000000 free + 0
000000604c68 000200000007 R_X86_64_JUMP_SLO 0000000000000000 abort + 0
000000604c70 000300000007 R_X86_64_JUMP_SLO 0000000000000000
__errno_location + 0
000000604c78 000400000007 R_X86_64_JUMP_SLO 0000000000000000 _exit + 0
000000604c80 000500000007 R_X86_64_JUMP_SLO 0000000000000000 __fpending + 0

(The list for .rela.plt has been truncated for brevity.)

If we now run "llvm-objdump-3.1 -r /bin/true", we will get a list of
entries in .rela.plt section:

$ llvm-objdump-3.1 -r /bin/true | grep -c JUMP_SLOT

So the question is: why llvm-objdump does not list relocation entries
in .rela.dyn section and is it possible to get at them somehow?


Received no answer, so reported a bug: see
http://llvm.org/bugs/show_bug.cgi?id=13650 .