Skip to content

Commit 98594a4

Browse files
committed
[lldb] [ObjectFile/ELF] Fix negated seg ids on 32-bit arches
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
1 parent 4c05019 commit 98594a4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ unsigned ELFRelocation::RelocAddend64(const ELFRelocation &rel) {
206206

207207
} // end anonymous namespace
208208

209-
static user_id_t SegmentID(size_t PHdrIndex) { return ~PHdrIndex; }
209+
static user_id_t SegmentID(size_t PHdrIndex) {
210+
return ~user_id_t(PHdrIndex);
211+
}
210212

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

0 commit comments

Comments
 (0)