[Lldb-commits] [PATCH] D132954: lldb: Add support for R_386_32 relocations to ObjectFileELF
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 5 07:24:26 PDT 2022
labath added a comment.
In D132954#3767083 <https://reviews.llvm.org/D132954#3767083>, @dmlary wrote:
> @labath it doesn't look like the relocations are applied during `lldb-test object-file --contents`:
I'm definitely seeing `ObjectFileELF::RelocateSection` be invoked with this command (I'm using it on a random .o file from my lldb build). Could you step through the function to see why that does not happen for you?
* frame #0: 0x0000555556916576 lldb-test`ObjectFileELF::RelocateSection(this=0x0000555564473a60, section=0x00005555645310e0) at ObjectFileELF.cpp:2857:26
frame #1: 0x00005555564b50de lldb-test`lldb_private::ObjectFile::ReadSectionData(this=0x0000555564473a60, section=0x00005555645310e0, section_data=0x00007fffffffce80) at ObjectFile.cpp:530:20
frame #2: 0x00005555569187e1 lldb-test`ObjectFileELF::ReadSectionData(this=0x0000555564473a60, section=0x00005555645310e0, section_data=0x00007fffffffce80) at ObjectFileELF.cpp:3350:46
frame #3: 0x00005555562f0c7c lldb-test`lldb_private::Section::GetSectionData(this=0x00005555645310e0, section_data=0x00007fffffffce80) at Section.cpp:381:39
> 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` as the symbol for relocation; it has a non-zero offset within its section. Even in that case there were no modifications made to the data in `.debug_info`.
>
> It looks like I'll need to build a binary and a separate object file in the test case. Any chance you know of a test off-hand building multiple things, with specific flags?
That will be a bit messy. I'd rather figure out what's going on with the lldb-test command..
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