[LLVMbugs] [Bug 13650] New: llvm-objdump does not give information about all relocations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 20 04:29:44 PDT 2012


             Bug #: 13650
           Summary: llvm-objdump does not give information about all
           Product: libraries
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Archive library
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: Aleksandrs.Saveljevs at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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
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 +
000000604c38  001800000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ +
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 +
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 +
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 only get a list of
entries in .rela.plt section:

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

It would be nice if there would be a way to get at relocation entries in
.rela.dyn section.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list