Skip to content

Commit 4350bab

Browse files
author
Chen Zheng
committed
address comments
1 parent 44cbb15 commit 4350bab

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

llvm/lib/Object/XCOFFObjectFile.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,11 @@ Expected<bool> XCOFFSymbolRef::isFunction() const {
12881288
if (CsectAuxRef.getSymbolType() == XCOFF::XTY_LD)
12891289
return true;
12901290

1291-
return createError("csect symbol has no valid symbol type.");
1291+
return createError(
1292+
"Symbol csect aux entry with index " +
1293+
Twine(getObject()->getSymbolIndex(CsectAuxRef.getEntryAddress())) +
1294+
" has invalid symbol type " +
1295+
Twine::utohexstr(CsectAuxRef.getSymbolType()));
12921296
}
12931297

12941298
bool XCOFFSymbolRef::isCsectSymbol() const {
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## Check that llvm-objdump --syms reports an error when
2+
## the symbol type in the csect aux entry of a symbol is not valid.
3+
4+
## Check XCOFF32
5+
# RUN: yaml2obj --docnum=1 %s -o %t1
6+
# RUN: not llvm-objdump --syms %t1 2>&1 | FileCheck %s -DOBJ=%t1 --check-prefix=XCOFF32
7+
8+
# XCOFF32: error: '[[OBJ]]': Symbol csect aux entry with index 2 has invalid symbol type 5
9+
10+
--- !XCOFF
11+
FileHeader:
12+
MagicNumber: 0x1DF
13+
Sections:
14+
- Name: .text
15+
Flags: [ STYP_TEXT ]
16+
Symbols:
17+
- Name: .file
18+
Section: N_DEBUG
19+
NumberOfAuxEntries: 0
20+
Type: 0x0
21+
StorageClass: C_FILE
22+
- Name: test
23+
Section: .text
24+
NumberOfAuxEntries: 1
25+
StorageClass: C_EXT
26+
AuxEntries:
27+
- Type: AUX_CSECT
28+
SymbolAlignmentAndType: 5
29+
StorageMappingClass: XMC_PR
30+
31+
## Check XCOFF64
32+
# RUN: yaml2obj --docnum=2 %s -o %t2
33+
# RUN: not llvm-objdump --syms %t2 2>&1 | FileCheck %s -DOBJ=%t2 --check-prefix=XCOFF64
34+
35+
# XCOFF64: error: '[[OBJ]]': Symbol csect aux entry with index 2 has invalid symbol type 5
36+
37+
--- !XCOFF
38+
FileHeader:
39+
MagicNumber: 0x1F7
40+
Sections:
41+
- Name: .text
42+
Flags: [ STYP_TEXT ]
43+
Symbols:
44+
- Name: .file
45+
Section: N_DEBUG
46+
NumberOfAuxEntries: 0
47+
Type: 0x0
48+
StorageClass: C_FILE
49+
- Name: test
50+
Section: .text
51+
NumberOfAuxEntries: 1
52+
StorageClass: C_EXT
53+
AuxEntries:
54+
- Type: AUX_CSECT
55+
SymbolAlignmentAndType: 5
56+
StorageMappingClass: XMC_PR

0 commit comments

Comments
 (0)