brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.7 KiB · 25eeee5 Raw
115 lines · plain
1## In this test case we check how we print section and flag descriptions for different targets.2 3## EM_NONE is a target that does not have any processor and OS specific flags,4## we use it to show how the default flag key is printed.5 6# RUN: yaml2obj -DBITS=32 %s -o %t-default.o7# RUN: llvm-readelf -S %t-default.o | FileCheck %s --check-prefix=ELF32 --strict-whitespace --match-full-lines8 9#       ELF32:There are 9 section headers, starting at offset 0x9c:10# ELF32-EMPTY:11# ELF32-NEXT:Section Headers:12# ELF32-NEXT:  [Nr] Name              Type            Address  Off    Size   ES Flg Lk Inf Al13# ELF32-NEXT:  [ 0]                   NULL            00000000 000000 000000 00      0   0  014# ELF32-NEXT:  [ 1] .text             PROGBITS        00000000 000034 000001 00  AX  0   0  415# ELF32-NEXT:  [ 2] .rel.text         REL             00000000 000038 000000 08      6   1  416# ELF32-NEXT:  [ 3] .rela.text        RELA            00000000 000038 000000 18      6   1  817# ELF32-NEXT:  [ 4] .data             PROGBITS        00000000 000038 000000 00  WA  0   0  418# ELF32-NEXT:  [ 5] .bss              NOBITS          00000000 000038 000000 00  WA  0   0  419# ELF32-NEXT:  [ 6] .symtab           SYMTAB          00000000 000038 000020 10      7   2  820# ELF32-NEXT:  [ 7] .strtab           STRTAB          00000000 000058 000007 00      0   0  121# ELF32-NEXT:  [ 8] .shstrtab         STRTAB          00000000 00005f 00003b 00      0   0  122# ELF32-NEXT:Key to Flags:23# ELF32-NEXT:  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),24# ELF32-NEXT:  L (link order), O (extra OS processing required), G (group), T (TLS),25# ELF32-NEXT:  C (compressed), x (unknown), o (OS specific), E (exclude),26# ELF32-NEXT:  R (retain), p (processor specific)27 28--- !ELF29FileHeader:30  Class:   ELFCLASS[[BITS=64]]31  Data:    ELFDATA2LSB32  OSABI:   ELFOSABI_GNU33  Type:    ET_REL34  Machine: [[MACHINE=EM_NONE]]35Sections:36  - Name:         .text37    Type:         SHT_PROGBITS38    Flags:        [ SHF_ALLOC, SHF_EXECINSTR ]39    AddressAlign: 0x000000000000000440    Content:      0041  - Name:         .rel.text42    Type:         SHT_REL43    Link:         .symtab44    AddressAlign: 0x000000000000000445    EntSize:      0x000000000000000846    Info:         .text47    Relocations:48  - Name:         .rela.text49    Type:         SHT_RELA50    Link:         .symtab51    AddressAlign: 0x000000000000000852    EntSize:      0x000000000000001853    Info:         .text54    Relocations:55  - Name:         .data56    Type:         SHT_PROGBITS57    Flags:        [ SHF_WRITE, SHF_ALLOC ]58    AddressAlign: 0x000000000000000459    Content:      ''60  - Name:         .bss61    Type:         SHT_NOBITS62    Flags:        [ SHF_WRITE, SHF_ALLOC ]63    AddressAlign: 0x000000000000000464Symbols:65  - Name:         .text66    Type:         STT_SECTION67    Section:      .text68 69## For an EM_X86_64 target we print "l" for the SHF_X86_64_LARGE section flag.70## Check we mention it in the flag key.71 72# RUN: yaml2obj -DMACHINE=EM_X86_64 %s -o %t-x64.o73# RUN: llvm-readelf -S %t-x64.o | FileCheck %s --check-prefix=ELF64 --strict-whitespace --match-full-lines74 75## Check that --wide is the same as -W and ignored and also76## that --section is the same as -S.77# RUN: llvm-readobj --wide --sections %t-x64.o --elf-output-style=GNU \78# RUN:   | FileCheck %s --check-prefix=ELF6479# RUN: llvm-readobj -W --sections %t-x64.o --elf-output-style=GNU \80# RUN:   | FileCheck %s --check-prefix=ELF6481# RUN: llvm-readelf -W -S %t-x64.o | FileCheck %s --check-prefix=ELF6482 83#       ELF64:There are 9 section headers, starting at offset 0xc0:84# ELF64-EMPTY:85# ELF64-NEXT:Section Headers:86# ELF64-NEXT:  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al87# ELF64-NEXT:  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  088# ELF64-NEXT:  [ 1] .text             PROGBITS        0000000000000000 000040 000001 00  AX  0   0  489# ELF64-NEXT:  [ 2] .rel.text         REL             0000000000000000 000044 000000 08      6   1  490# ELF64-NEXT:  [ 3] .rela.text        RELA            0000000000000000 000048 000000 18      6   1  891# ELF64-NEXT:  [ 4] .data             PROGBITS        0000000000000000 000048 000000 00  WA  0   0  492# ELF64-NEXT:  [ 5] .bss              NOBITS          0000000000000000 000048 000000 00  WA  0   0  493# ELF64-NEXT:  [ 6] .symtab           SYMTAB          0000000000000000 000048 000030 18      7   2  894# ELF64-NEXT:  [ 7] .strtab           STRTAB          0000000000000000 000078 000007 00      0   0  195# ELF64-NEXT:  [ 8] .shstrtab         STRTAB          0000000000000000 00007f 00003b 00      0   0  196# ELF64-NEXT:Key to Flags:97# ELF64-NEXT:  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),98# ELF64-NEXT:  L (link order), O (extra OS processing required), G (group), T (TLS),99# ELF64-NEXT:  C (compressed), x (unknown), o (OS specific), E (exclude),100# ELF64-NEXT:  R (retain), l (large), p (processor specific)101 102## For an EM_ARM or EM_AARCH64 target we print "y" for the PURECODE section flag.103## Check we mention it in the flag key.104 105# RUN: yaml2obj -DMACHINE=EM_ARM %s -o %t-arm.o106# RUN: llvm-readelf -S %t-arm.o | FileCheck %s --check-prefix=PURECODE --strict-whitespace --match-full-lines107# RUN: yaml2obj -DMACHINE=EM_AARCH64 %s -o %t-aarch64.o108# RUN: llvm-readelf -S %t-aarch64.o | FileCheck %s --check-prefix=PURECODE --strict-whitespace --match-full-lines109 110#      PURECODE:Key to Flags:111# PURECODE-NEXT:  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),112# PURECODE-NEXT:  L (link order), O (extra OS processing required), G (group), T (TLS),113# PURECODE-NEXT:  C (compressed), x (unknown), o (OS specific), E (exclude),114# PURECODE-NEXT:  R (retain), y (purecode), p (processor specific)115