[Lldb-commits] [PATCH] D42931: ELF GetSectionHeaderInfo: process SHT_NOTE even without .shstrtab

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 5 13:45:45 PST 2018


jankratochvil created this revision.
jankratochvil added a reviewer: labath.
Herald added subscribers: emaste, srhines.

This is written for tha YAML testcase of https://reviews.llvm.org/D42914. Its unstripped.yaml contains:

    Start of section headers:          64 (bytes into file)
    Number of program headers:         0
    Section header string table index: 5
  Section Headers:
    [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
    [ 1] .note.gnu.build-id NOTE            0000000000400274 0001c0 000024 00   A  0   0  4
    [ 5] .shstrtab         STRTAB          0000000000000000 000226 000034 00      0   0  1

while there is:

  ObjectFile::GetModuleSpecifications:
    DataBufferSP data_sp = DataBufferLLVM::CreateSliceFromPath(file.GetPath(), 512, file_offset);

and so `ObjectFileELF::GetSectionHeaderInfo` has only 0x200 bytes available to find UUID (=build-id).  It could find it if there were either program headers present (obj2yaml does not preserve them) or if .shstrtab was present in the first 512 bytes (which it is not).
But then we do not need .shstrtab as we can identify the note section by its SHT_NOTE, we do not need its name. That's this patch.
It does not have a testcase but https://reviews.llvm.org/D42914 does FAIL for me without this patch on Fedora 27 x86_64.


https://reviews.llvm.org/D42931

Files:
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42931.132887.patch
Type: text/x-patch
Size: 11693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180205/da5dec4f/attachment-0001.bin>


More information about the lldb-commits mailing list