Skip to content

Commit

Permalink
[lldb] [ObjectFile/ELF] Fix negated seg ids on 32-bit arches
Browse files Browse the repository at this point in the history
Scale segment identifier up to user_id_t before negating it.  This fixes
the identifers being wrongly e.g. 0x00000000fffffffe instead of
0xfffffffffffffffe.  Fix suggested by Pavel Labath.

This fixes 5 tests failing on i386 (PR #44748):

  lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-PT_INTERP.yaml
  lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-PT_TLS.yaml
  lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-section.yaml
  lldb-shell :: ObjectFile/ELF/PT_LOAD.yaml
  lldb-shell :: ObjectFile/ELF/PT_TLS-overlap-PT_LOAD.yaml

Differential Revision: https://reviews.llvm.org/D73914
  • Loading branch information
mgorny committed Feb 4, 2020
1 parent 4c05019 commit 98594a4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ unsigned ELFRelocation::RelocAddend64(const ELFRelocation &rel) {

} // end anonymous namespace

static user_id_t SegmentID(size_t PHdrIndex) { return ~PHdrIndex; }
static user_id_t SegmentID(size_t PHdrIndex) {
return ~user_id_t(PHdrIndex);
}

bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) {
// Read all fields.
Expand Down

0 comments on commit 98594a4

Please sign in to comment.