brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 1a110fb Raw
85 lines · plain
1## Test various details of llvm-objdump -h/--section-headers for XCOFF.2 3## Check the -h/--section-headers option prints section headers correctly.4# RUN: yaml2obj %s --docnum=1 -o %t-basic.o5# RUN: llvm-objdump --section-headers %t-basic.o | FileCheck %s6 7# CHECK:      Sections:8# CHECK-NEXT: Idx Name          Size     VMA      Type9# CHECK-NEXT:   0 .text         00000008 00000008 TEXT10# CHECK-NEXT:   1 .data         00000004 00000000 DATA11# CHECK-NEXT:   2 .bss          00000000 00000010 BSS12# CHECK-NEXT:   3 .tdata        00000004 00000000 DATA13# CHECK-NEXT:   4 .tbss         00000000 00000004 BSS14# CHECK-NEXT:   5 .dwline       00000046 00000000 DEBUG15# CHECK-NEXT:   6 .debug        00000046 00000000 DEBUG16 17--- !XCOFF18FileHeader:19  MagicNumber: 0x1DF20Sections:21  - Name:    .text22    Address: 0x823    Size:    0x824    Flags:   [ STYP_TEXT ]25  - Name:    .data26    Size:    0x427    Flags:   [ STYP_DATA ]28  - Name:    .bss29    Size:    0x030    Address: 0x1031    Flags:   [ STYP_BSS ]32  - Name:    .tdata33    Size:    0x434    Flags:   [ STYP_TDATA ]35  - Name:    .tbss36    Size:    0x037    Flags:   [ STYP_TBSS ]38  - Name:    .dwline39    Size:    0x4640    Flags:   [ STYP_DWARF ]41  - Name:    .debug42    Size:    0x4643    Flags:   [ STYP_DEBUG ]44 45## Check the -h/--section-headers option prints long section names.46# RUN: yaml2obj %s --docnum=2 -o %t-longname.o47# RUN: llvm-objdump --section-headers %t-longname.o \48# RUN:   | FileCheck %s --check-prefix=LONG49 50# LONG:      Sections:51# LONG-NEXT: Idx Name          Size     VMA      Type52# LONG-NEXT:   0 .dwarnge      00000004 0000000053# LONG-NEXT:   1 .dwpbnms      00000004 0000000054# LONG-NEXT:   2 .dwpbtyp      00000004 0000000055 56--- !XCOFF57FileHeader:58  MagicNumber: 0x1DF59Sections:60  - Name:  .dwarnge61    Size:  0x462    Flags: [ STYP_PAD ]63  - Name:  .dwpbnms64    Size:  0x465    Flags: [ STYP_PAD ]66  - Name:  .dwpbtyp67    Size:  0x468    Flags: [ STYP_PAD ]69 70## Truncate the file to end before the section header table ends.71# RUN: yaml2obj %s --docnum=3 -o %t-truncate.o72# RUN: %python -c "with open('%/t-truncate.o', 'r+b') as input: input.truncate(20)"73# RUN: not llvm-objdump --section-headers %t-truncate.o 2>&1 \74# RUN:  | FileCheck --check-prefix=ERROR %s75 76# ERROR: The end of the file was unexpectedly encountered: section headers with offset 0x14 and size 0x28 go past the end of the file77 78--- !XCOFF79FileHeader:80  MagicNumber: 0x1DF81Sections:82  - Name:  .text83    Size:  0x884    Flags: [ STYP_TEXT ]85