Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LoongArch] Parse LoongArch base ABI in ObjectYAML and llvm-readobj
LoongArch e_flags definition: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_e_flags_identifies_abi_type_and_version Differential Revision: https://reviews.llvm.org/D130238
- Loading branch information
1 parent
ae8a660
commit aff68f5
Showing
5 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
## Check llvm-readobj is able to decode all possible LoongArch e_flags field values. | ||
|
||
# RUN: yaml2obj %s -o %t-lp64s -DCLASS=64 -DFLAG=LP64S | ||
# RUN: llvm-readobj -h %t-lp64s | FileCheck --check-prefix=READOBJ-LP64S %s | ||
# RUN: llvm-readelf -h %t-lp64s | FileCheck --check-prefix=READELF-LP64S --match-full-lines %s | ||
|
||
# RUN: yaml2obj %s -o %t-lp64f -DCLASS=64 -DFLAG=LP64F | ||
# RUN: llvm-readobj -h %t-lp64f | FileCheck --check-prefix=READOBJ-LP64F %s | ||
# RUN: llvm-readelf -h %t-lp64f | FileCheck --check-prefix=READELF-LP64F --match-full-lines %s | ||
|
||
# RUN: yaml2obj %s -o %t-lp64d -DCLASS=64 -DFLAG=LP64D | ||
# RUN: llvm-readobj -h %t-lp64d | FileCheck --check-prefix=READOBJ-LP64D %s | ||
# RUN: llvm-readelf -h %t-lp64d | FileCheck --check-prefix=READELF-LP64D --match-full-lines %s | ||
|
||
# RUN: yaml2obj %s -o %t-ilp32s -DCLASS=32 -DFLAG=ILP32S | ||
# RUN: llvm-readobj -h %t-ilp32s | FileCheck --check-prefix=READOBJ-ILP32S %s | ||
# RUN: llvm-readelf -h %t-ilp32s | FileCheck --check-prefix=READELF-ILP32S --match-full-lines %s | ||
|
||
# RUN: yaml2obj %s -o %t-ilp32f -DCLASS=32 -DFLAG=ILP32F | ||
# RUN: llvm-readobj -h %t-ilp32f | FileCheck --check-prefix=READOBJ-ILP32F %s | ||
# RUN: llvm-readelf -h %t-ilp32f | FileCheck --check-prefix=READELF-ILP32F --match-full-lines %s | ||
|
||
# RUN: yaml2obj %s -o %t-ilp32d -DCLASS=32 -DFLAG=ILP32D | ||
# RUN: llvm-readobj -h %t-ilp32d | FileCheck --check-prefix=READOBJ-ILP32D %s | ||
# RUN: llvm-readelf -h %t-ilp32d | FileCheck --check-prefix=READELF-ILP32D --match-full-lines %s | ||
|
||
# READOBJ-LP64S: Flags [ (0x1) | ||
# READOBJ-LP64S-NEXT: EF_LOONGARCH_BASE_ABI_LP64S (0x1) | ||
# READOBJ-LP64S-NEXT: ] | ||
|
||
# READOBJ-LP64F: Flags [ (0x2) | ||
# READOBJ-LP64F-NEXT: EF_LOONGARCH_BASE_ABI_LP64F (0x2) | ||
# READOBJ-LP64F-NEXT: ] | ||
|
||
# READOBJ-LP64D: Flags [ (0x3) | ||
# READOBJ-LP64D-NEXT: EF_LOONGARCH_BASE_ABI_LP64D (0x3) | ||
# READOBJ-LP64D-NEXT: ] | ||
|
||
# READOBJ-ILP32S: Flags [ (0x5) | ||
# READOBJ-ILP32S-NEXT: EF_LOONGARCH_BASE_ABI_ILP32S (0x5) | ||
# READOBJ-ILP32S-NEXT: ] | ||
|
||
# READOBJ-ILP32F: Flags [ (0x6) | ||
# READOBJ-ILP32F-NEXT: EF_LOONGARCH_BASE_ABI_ILP32F (0x6) | ||
# READOBJ-ILP32F-NEXT: ] | ||
|
||
# READOBJ-ILP32D: Flags [ (0x7) | ||
# READOBJ-ILP32D-NEXT: EF_LOONGARCH_BASE_ABI_ILP32D (0x7) | ||
# READOBJ-ILP32D-NEXT: ] | ||
|
||
# READELF-LP64S: Flags: 0x1, LP64, SOFT-FLOAT | ||
# READELF-LP64F: Flags: 0x2, LP64, SINGLE-FLOAT | ||
# READELF-LP64D: Flags: 0x3, LP64, DOUBLE-FLOAT | ||
# READELF-ILP32S: Flags: 0x5, ILP32, SOFT-FLOAT | ||
# READELF-ILP32F: Flags: 0x6, ILP32, SINGLE-FLOAT | ||
# READELF-ILP32D: Flags: 0x7, ILP32, DOUBLE-FLOAT | ||
|
||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS[[CLASS]] | ||
Data: ELFDATA2LSB | ||
Type: ET_EXEC | ||
Machine: EM_LOONGARCH | ||
Flags: [ EF_LOONGARCH_BASE_ABI_[[FLAG]] ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Check obj2yaml is able to decode all possible LoongArch e_flags field values. | ||
|
||
# RUN: yaml2obj %s -o %t-lp64s -DCLASS=64 -DFLAG=LP64S | ||
# RUN: obj2yaml %t-lp64s | FileCheck -DFLAG=LP64S %s | ||
|
||
# RUN: yaml2obj %s -o %t-lp64f -DCLASS=64 -DFLAG=LP64F | ||
# RUN: obj2yaml %t-lp64f | FileCheck -DFLAG=LP64F %s | ||
|
||
# RUN: yaml2obj %s -o %t-lp64d -DCLASS=64 -DFLAG=LP64D | ||
# RUN: obj2yaml %t-lp64d | FileCheck -DFLAG=LP64D %s | ||
|
||
# RUN: yaml2obj %s -o %t-ilp32s -DCLASS=32 -DFLAG=ILP32S | ||
# RUN: obj2yaml %t-ilp32s | FileCheck -DFLAG=ILP32S %s | ||
|
||
# RUN: yaml2obj %s -o %t-ilp32f -DCLASS=32 -DFLAG=ILP32F | ||
# RUN: obj2yaml %t-ilp32f | FileCheck -DFLAG=ILP32F %s | ||
|
||
# RUN: yaml2obj %s -o %t-ilp32d -DCLASS=32 -DFLAG=ILP32D | ||
# RUN: obj2yaml %t-ilp32d | FileCheck -DFLAG=ILP32D %s | ||
|
||
# CHECK: Flags: [ EF_LOONGARCH_BASE_ABI_[[FLAG]] ] | ||
|
||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS[[CLASS]] | ||
Data: ELFDATA2LSB | ||
Type: ET_EXEC | ||
Machine: EM_LOONGARCH | ||
Flags: [ EF_LOONGARCH_BASE_ABI_[[FLAG]] ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters