[all-commits] [llvm/llvm-project] f0697d: Don't create sections for SHN_ABS symbols in ELF f...

Greg Clayton via All-commits all-commits at lists.llvm.org
Mon Aug 22 14:46:48 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f0697d7c3fb5296cfec1718206aceb77b7ca9ab8
      https://github.com/llvm/llvm-project/commit/f0697d7c3fb5296cfec1718206aceb77b7ca9ab8
  Author: Greg Clayton <gclayton at fb.com>
  Date:   2022-08-22 (Mon, 22 Aug 2022)

  Changed paths:
    M lldb/bindings/interface/SBSymbol.i
    M lldb/include/lldb/API/SBSymbol.h
    M lldb/include/lldb/Symbol/Symbol.h
    M lldb/source/API/SBSymbol.cpp
    M lldb/source/Commands/CommandObjectTarget.cpp
    M lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    M lldb/source/Symbol/Symbol.cpp
    A lldb/test/API/python_api/absolute_symbol/TestAbsoluteSymbol.py
    A lldb/test/API/python_api/absolute_symbol/absolute.yaml
    M lldb/test/Shell/SymbolFile/absolute-symbol.test

  Log Message:
  -----------
  Don't create sections for SHN_ABS symbols in ELF files.

Symbols that have the section index of SHN_ABS were previously creating extra top level sections that contained the value of the symbol as if the symbol's value was an address. As far as I can tell, these symbol's values are not addresses, even if they do have a size. To make matters worse, adding these extra sections can stop address lookups from succeeding if the symbol's value + size overlaps with an existing section as these sections get mapped into memory when the image is loaded by the dynamic loader. This can cause stack frames to appear empty as the address lookup fails completely.

This patch:
- doesn't create a section for any SHN_ABS symbols
- makes symbols that are absolute have values that are not addresses
- add accessors to SBSymbol to get the value and size of a symbol as raw integers. Prevoiusly there was no way to access a symbol's value from a SBSymbol because the only accessors were:

  SBAddress SBSymbol::GetStartAddress();
  SBAddress SBSymbol::GetEndAddress();

  and these accessors would return an invalid SBAddress if the symbol's value wasn't an address
- Adds a test to ensure no ".absolute.<symbol-name>" sections are created
- Adds a test to test the new SBSymbol APIs

Differential Revision: https://reviews.llvm.org/D131705




More information about the All-commits mailing list