[Lldb-commits] [PATCH] D132954: lldb: Add support for R_386_32 relocations to ObjectFileELF

David M. Lary via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 2 08:46:48 PDT 2022


dmlary added a comment.

@labath it doesn't look like the relocations are applied during `lldb-test object-file --contents`:

from obj2yaml for rel.c described in summary (with added spacing for readabilty):

  [...]
    - Name:            .debug_info
      Type:            SHT_PROGBITS
      AddressAlign:    0x1
      Content:
        74000000 04000000 00000401 09000000 01890000 00620000 00000000 00023400
        00002D00 0000032D 0000001F 00040407 00000000 04010684 00000005 7C000000
        01024C00 00000503 00000000 061D0000 00023400 00006100 0000032D 00000004
        00077661 72000103 72000000 05030000 00000651 00000000
  [...]
    - Name:            .rel.debug_info
      Type:            SHT_REL
      Flags:           [ SHF_INFO_LINK ]
      Link:            .symtab
      AddressAlign:    0x4
      Info:            .debug_info
      Relocations:
        - Offset:          0x6
          Symbol:          .debug_abbrev
          Type:            R_386_32
        - Offset:          0xC
          Symbol:          .debug_str
          Type:            R_386_32
        - Offset:          0x11
  [...]

output for `.debug_info` from `lldb-test object-file --contents rel.o`:

  txt
    Index: 3
    ID: 0x4
    Name: .debug_info
    Type: dwarf-info
    Permissions: ---
    Thread specific: no
    VM address: 0x0
    VM size: 0
    File size: 120
    Data:  (
        0000: 74000000 04000000 00000401 09000000 01890000 00620000 00000000 00023400  |t....................b........4.|
        0020: 00002D00 0000032D 0000001F 00040407 00000000 04010684 00000005 7C000000  |..-....-....................|...|
        0040: 01024C00 00000503 00000000 061D0000 00023400 00006100 0000032D 00000004  |..L...............4...a....-....|
        0060: 00077661 72000103 72000000 05030000 00000651 00000000                    |..var...r..........Q....|
    )

I would expect at least one byte in the output to be changed if relocations were being applied to `.debug_info`.  To ensure it's not just relocating using a base address of 0, I modified one relocation to use `var


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132954/new/

https://reviews.llvm.org/D132954



More information about the lldb-commits mailing list