-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-readobj][ELF] Teach llvm-readobj to show arch specific ELF sect…
…ion's flags Some architecture specific ELF section flags might have the same value (for example SHF_X86_64_LARGE and SHF_HEX_GPREL) and we have to check machine architectures to select an appropriate set of possible flags. The patch selects architecture specific flags into separate arrays `ElfxxxSectionFlags` and combines `ElfSectionFlags` and `ElfxxxSectionFlags` before pass to the `StreamWriter::printFlags()` method. Differential Revision: http://reviews.llvm.org/D16269 llvm-svn: 258334
- Loading branch information
Showing
4 changed files
with
157 additions
and
3 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,90 @@ | ||
# Check that llvm-readobj shows arch specific ELF section flags. | ||
|
||
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-amdgpu.o | ||
# RUN: llvm-readobj -s %t-amdgpu.o | FileCheck -check-prefix=AMD %s | ||
|
||
# AMD: Flags [ (0x300000) | ||
# AMD-NEXT: SHF_AMDGPU_HSA_GLOBAL (0x100000) | ||
# AMD-NEXT: SHF_AMDGPU_HSA_READONLY (0x200000) | ||
# AMD-NEXT: ] | ||
|
||
# amdgpu.o | ||
--- | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
OSABI: ELFOSABI_GNU | ||
Type: ET_REL | ||
Machine: EM_AMDGPU | ||
Flags: [] | ||
Sections: | ||
- Name: .amdgpu | ||
Type: SHT_PROGBITS | ||
Flags: [SHF_AMDGPU_HSA_GLOBAL, SHF_AMDGPU_HSA_READONLY] | ||
Size: 4 | ||
|
||
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-hex.o | ||
# RUN: llvm-readobj -s %t-hex.o | FileCheck -check-prefix=HEX %s | ||
|
||
# HEX: Flags [ (0x10000000) | ||
# HEX-NEXT: SHF_HEX_GPREL (0x10000000) | ||
# HEX-NEXT: ] | ||
|
||
# hex.o | ||
--- | ||
FileHeader: | ||
Class: ELFCLASS32 | ||
Data: ELFDATA2LSB | ||
Type: ET_REL | ||
Machine: EM_HEXAGON | ||
Flags: [] | ||
Sections: | ||
- Name: .hex | ||
Type: SHT_PROGBITS | ||
Flags: [SHF_HEX_GPREL] | ||
Size: 4 | ||
|
||
# RUN: yaml2obj -format=elf -docnum 3 %s > %t-mips.o | ||
# RUN: llvm-readobj -s %t-mips.o | FileCheck -check-prefix=MIPS %s | ||
|
||
# MIPS: Flags [ (0x38000000) | ||
# MIPS-NEXT: SHF_MIPS_GPREL (0x10000000) | ||
# MIPS-NEXT: SHF_MIPS_MERGE (0x20000000) | ||
# MIPS-NEXT: SHF_MIPS_NOSTRIP (0x8000000) | ||
# MIPS-NEXT: ] | ||
|
||
# mips.o | ||
--- | ||
FileHeader: | ||
Class: ELFCLASS32 | ||
Data: ELFDATA2LSB | ||
Type: ET_REL | ||
Machine: EM_MIPS | ||
Flags: [] | ||
Sections: | ||
- Name: .mips | ||
Type: SHT_PROGBITS | ||
Flags: [SHF_MIPS_GPREL, SHF_MIPS_MERGE, SHF_MIPS_NOSTRIP] | ||
Size: 4 | ||
|
||
# RUN: yaml2obj -format=elf -docnum 4 %s > %t-x86_64.o | ||
# RUN: llvm-readobj -s %t-x86_64.o | FileCheck -check-prefix=X86_64 %s | ||
|
||
# X86_64: Flags [ (0x10000000) | ||
# X86_64-NEXT: SHF_X86_64_LARGE (0x10000000) | ||
# X86_64-NEXT: ] | ||
|
||
# x86_64.o | ||
--- | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
Type: ET_REL | ||
Machine: EM_X86_64 | ||
Flags: [] | ||
Sections: | ||
- Name: .x86_64 | ||
Type: SHT_PROGBITS | ||
Flags: [SHF_X86_64_LARGE] | ||
Size: 4 | ||
... |
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