
Summary: llvm-readobj decide whether to decode the external symbol's function auxiliary entry based on whether symbol is function or not currently. But the XCOFFSymbolRef::isFunction() do not work properly when -ffunction-sections is enabled. we will not decode the function auxiliary entry based on the XCOFFSymbolRef::isFunction() we will decode the function auxiliary entry based on following: According to the https://www.ibm.com/docs/en/aix/7.2?topic=formats-xcoff-object-file-format#XCOFF__c0f91ad419jbau In XCOFF32, there are only "one csect Auxiliary Entry" and "a function auxiliary symbol table entry" for the C_EXT, C_WEAKEXT, and C_HIDEXT Symbols. and By convention, the csect auxiliary entry in an XCOFF32 file must be the last auxiliary entry for any external symbol that has more than one auxiliary entry( that means for the C_EXT, C_WEAKEXT, and C_HIDEXT Symbols. if there more than one auxiliary Entries. we look the last one as csect auxiliary entry. and others auxiliary entries as function entries). Reviewers: Hubert Tong, James Henderson Differential Revision: https://reviews.llvm.org/D136950
64 lines
2.3 KiB
Plaintext
64 lines
2.3 KiB
Plaintext
## Test that we report warnings or dump raw data when symbols are invalid.
|
|
|
|
--- !XCOFF
|
|
FileHeader:
|
|
MagicNumber: 0x1DF
|
|
Symbols:
|
|
- Name: .sym
|
|
- Name: .fun
|
|
StorageClass: [[STORAGECLASS='C_EXT']]
|
|
NumberOfAuxEntries: 2
|
|
|
|
# RUN: yaml2obj %s --docnum=1 -DSTORAGECLASS='C_STAT' -o %t1
|
|
# RUN: llvm-readobj --syms %t1 2>&1 | FileCheck %s -DFILE=%t1 --check-prefix=CASE1
|
|
|
|
# CASE1: warning: '[[FILE]]': the C_STAT symbol at index 1 should not have more than 1 auxiliary entry
|
|
|
|
# RUN: yaml2obj %s --docnum=1 -DSTORAGECLASS='C_DWARF' -o %t2
|
|
# RUN: llvm-readobj --syms %t2 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=CASE2
|
|
|
|
# CASE2: warning: '[[FILE]]': the C_DWARF symbol at index 1 should not have more than 1 auxiliary entry
|
|
|
|
# RUN: yaml2obj %s --docnum=1 -DSTORAGECLASS='C_BLOCK' -o %t3
|
|
# RUN: llvm-readobj --syms %t3 2>&1 | FileCheck %s -DFILE=%t3 --check-prefix=CASE3
|
|
|
|
# CASE3: warning: '[[FILE]]': the C_BLOCK symbol at index 1 should not have more than 1 auxiliary entry
|
|
|
|
# RUN: yaml2obj %s --docnum=1 -DSTORAGECLASS='C_FCN' -o %t4
|
|
# RUN: llvm-readobj --syms %t4 2>&1 | FileCheck %s -DFILE=%t4 --check-prefix=CASE4
|
|
|
|
# CASE4: warning: '[[FILE]]': the C_FCN symbol at index 1 should not have more than 1 auxiliary entry
|
|
|
|
## This case tests the raw data output ability when a file auxiliary entry does
|
|
## not have the matching auxiliary type.
|
|
# RUN: yaml2obj %s --docnum=2 -o %t5
|
|
# RUN: llvm-readobj --syms %t5 | FileCheck %s --strict-whitespace --match-full-lines --check-prefix=CASE5
|
|
|
|
# CASE5:Symbols [
|
|
# CASE5-NEXT: Symbol {
|
|
# CASE5-NEXT: Index: 0
|
|
# CASE5-NEXT: Name: .fun
|
|
# CASE5-NEXT: Value (SymbolTableIndex): 0x0
|
|
# CASE5-NEXT: Section: N_UNDEF
|
|
# CASE5-NEXT: Source Language ID: TB_C (0x0)
|
|
# CASE5-NEXT: CPU Version ID: 0x0
|
|
# CASE5-NEXT: StorageClass: C_FILE (0x67)
|
|
# CASE5-NEXT: NumberOfAuxEntries: 1
|
|
# CASE5-NEXT: !Unexpected raw auxiliary entry data:
|
|
# CASE5-NEXT: 00000000 00000001 00020300 00000000 00fb
|
|
# CASE5-NEXT: }
|
|
# CASE5-NEXT:]
|
|
|
|
--- !XCOFF
|
|
FileHeader:
|
|
MagicNumber: 0x1F7
|
|
Symbols:
|
|
- Name: .fun
|
|
StorageClass: C_FILE
|
|
AuxEntries:
|
|
- Type: AUX_CSECT
|
|
ParameterHashIndex: 1
|
|
TypeChkSectNum: 2
|
|
SymbolAlignmentAndType: 3
|
|
StorageMappingClass: XMC_PR
|