Skip to content

Commit 7ebff6a

Browse files
alvinhochunmstorsjo
authored andcommitted
[lldb][COFF] Load absolute symbols from COFF symbol table
Reviewed By: labath Differential Revision: https://reviews.llvm.org/D134517
1 parent 20c2f94 commit 7ebff6a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,9 @@ void ObjectFilePECOFF::AppendFromCOFFSymbolTable(
830830
symbol.SetType(exported->GetType());
831831
}
832832
}
833+
} else if (section_number == llvm::COFF::IMAGE_SYM_ABSOLUTE) {
834+
symbol.GetAddressRef() = Address(coff_sym_ref.getValue());
835+
symbol.SetType(lldb::eSymbolTypeAbsolute);
833836
}
834837
symtab.AddSymbol(symbol);
835838
}

lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
## The .file symbol isn't checked, but is included to test that the symbol
55
## table iteration handles cases with a symbol with more than one aux symbol.
66

7-
# CHECK: Type File Address/Value {{.*}} Size Flags Name
8-
# CHECK: Code 0x0000000040001000 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry
9-
# CHECK: 0x0000000040002000 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable
7+
# CHECK: Type File Address/Value {{.*}} Size Flags Name
8+
# CHECK: Code 0x0000000040001000 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry
9+
# CHECK: 0x0000000040002000 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable
10+
# CHECK: Absolute 0x00000000deadbeef 0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} absolute_symbol
1011

1112
--- !COFF
1213
OptionalHeader:
@@ -123,4 +124,10 @@ symbols:
123124
SimpleType: IMAGE_SYM_TYPE_NULL
124125
ComplexType: IMAGE_SYM_DTYPE_NULL
125126
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
127+
- Name: absolute_symbol
128+
Value: 0xdeadbeef
129+
SectionNumber: -1
130+
SimpleType: IMAGE_SYM_TYPE_NULL
131+
ComplexType: IMAGE_SYM_DTYPE_NULL
132+
StorageClass: IMAGE_SYM_CLASS_STATIC
126133
...

0 commit comments

Comments
 (0)