1## Check that we are able to dump the SHT_MIPS_OPTIONS section using -A properly. 2 3## Check we are able to dump multiple MIPS options properly. 4# RUN: yaml2obj %s -o %t1 5# RUN: llvm-readobj -A %t1 | FileCheck %s 6# RUN: llvm-readelf -A %t1 | FileCheck %s 7 8# CHECK: MIPS Options { 9# CHECK-NEXT: ODK_REGINFO { 10# CHECK-NEXT: GP: 0x807060504030201 11# CHECK-NEXT: General Mask: 0xD0C0B0A 12# CHECK-NEXT: Co-Proc Mask0: 0x88776655 13# CHECK-NEXT: Co-Proc Mask1: 0xCCBBAA99 14# CHECK-NEXT: Co-Proc Mask2: 0x1EFFEEDD 15# CHECK-NEXT: Co-Proc Mask3: 0x5E4E3E2E 16# CHECK-NEXT: } 17# CHECK-NEXT: ODK_REGINFO { 18# CHECK-NEXT: GP: 0x0 19# CHECK-NEXT: General Mask: 0x0 20# CHECK-NEXT: Co-Proc Mask0: 0x0 21# CHECK-NEXT: Co-Proc Mask1: 0x0 22# CHECK-NEXT: Co-Proc Mask2: 0x0 23# CHECK-NEXT: Co-Proc Mask3: 0x0 24# CHECK-NEXT: } 25# CHECK-NEXT: } 26 27## Check that we try to dump the .MIPS.options section when we are able to locate it by name. 28# RUN: yaml2obj -DNAME=0xffff %s -o %t.err1 29# RUN: llvm-readelf -A %t.err1 2>&1 | \ 30# RUN: FileCheck %s -DFILE=%t.err1 --check-prefix=NAME-ERR-FOUND --implicit-check-not=warning: 31# RUN: llvm-readobj -A %t.err1 2>&1 | \ 32# RUN: FileCheck %s -DFILE=%t.err1 --check-prefix=NAME-ERR-FOUND --implicit-check-not=warning: 33 34# NAME-ERR-FOUND: warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 1: a section [index 1] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table 35# NAME-ERR-FOUND-NEXT: warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 3: a section [index 3] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table 36# NAME-ERR-FOUND: MIPS Options { 37# NAME-ERR-FOUND-NEXT: ODK_REGINFO { 38# NAME-ERR-FOUND-NEXT: GP: 0x807060504030201 39# NAME-ERR-FOUND-NEXT: General Mask: 0xD0C0B0A 40# NAME-ERR-FOUND-NEXT: Co-Proc Mask0: 0x88776655 41# NAME-ERR-FOUND-NEXT: Co-Proc Mask1: 0xCCBBAA99 42# NAME-ERR-FOUND-NEXT: Co-Proc Mask2: 0x1EFFEEDD 43# NAME-ERR-FOUND-NEXT: Co-Proc Mask3: 0x5E4E3E2E 44# NAME-ERR-FOUND-NEXT: } 45# NAME-ERR-FOUND-NEXT: ODK_REGINFO { 46# NAME-ERR-FOUND-NEXT: GP: 0x0 47# NAME-ERR-FOUND-NEXT: General Mask: 0x0 48# NAME-ERR-FOUND-NEXT: Co-Proc Mask0: 0x0 49# NAME-ERR-FOUND-NEXT: Co-Proc Mask1: 0x0 50# NAME-ERR-FOUND-NEXT: Co-Proc Mask2: 0x0 51# NAME-ERR-FOUND-NEXT: Co-Proc Mask3: 0x0 52# NAME-ERR-FOUND-NEXT: } 53# NAME-ERR-FOUND-NEXT: } 54 55--- !ELF 56FileHeader: 57 Class: ELFCLASS64 58 Data: ELFDATA2LSB 59 Type: ET_REL 60 Machine: EM_MIPS 61Sections: 62 - Type: SHT_PROGBITS 63 ShName: [[NAME=<none>]] 64 - Name: .MIPS.options 65 Type: SHT_MIPS_OPTIONS 66 ShName: [[OPTNAME=<none>]] 67 ShSize: [[SECSIZE=<none>]] 68 ContentArray: [ [[KIND=0x1]], ## Kind. ODK_REGINFO == 1. 69 [[DESCSIZE=0x28]], ## Byte size of descriptor, including this header. 70 0x0, 0x0, ## Section header index of section affected or 0 for global options. 71 0x0, 0x0, 0x0, 0x0, ## Kind-specific information. 72 0xA, 0xB, 0xC, 0xD, ## ODK_REGINFO: bit-mask of used general registers. 73 0x11, 0x22, 0x33, 0x44, ## ODK_REGINFO: unused padding field. 74 0x55, 0x66, 0x77, 0x88, ## ODK_REGINFO: bit-mask of used co-processor registers (0). 75 0x99, 0xAA, 0xBB, 0xCC, ## ODK_REGINFO: bit-mask of used co-processor registers (1). 76 0xDD, 0xEE, 0xFF, 0x1E, ## ODK_REGINFO: bit-mask of used co-processor registers (2). 77 0x2E, 0x3E, 0x4E, 0x5E, ## ODK_REGINFO: bit-mask of used co-processor registers (3). 78 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, ## ODK_REGINFO: gp register value. 79## A descriptor for one more arbirtary supported option. 80 0x1, 0x28, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 81 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 82 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 83 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] 84 - Type: SHT_PROGBITS 85 ShName: [[NAME=<none>]] 86 87## Check we report a warning when we are unable to find the .MIPS.options section due to an error. 88# RUN: yaml2obj -DOPTNAME=0xffff %s -o %t.err2 89# RUN: llvm-readelf -A %t.err2 2>&1 | \ 90# RUN: FileCheck %s -DFILE=%t.err2 --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning: --implicit-check-not="MIPS Options" 91# RUN: llvm-readobj -A %t.err2 2>&1 | \ 92# RUN: FileCheck %s -DFILE=%t.err2 --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning: --implicit-check-not="MIPS Options" 93 94# NAME-ERR-NOTFOUND: warning: '[[FILE]]': unable to read the name of SHT_MIPS_OPTIONS section with index 2: a section [index 2] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table 95 96## Check we report a warning when the .MIPS.options section has a size that is less than the 97## size of the .MIPS.options description header. 98 99# RUN: yaml2obj %s -DSECSIZE=0x1 -o %t2 100# RUN: llvm-readelf -A %t2 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=SEC-SIZE 101# RUN: llvm-readobj -A %t2 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=SEC-SIZE 102 103# SEC-SIZE: MIPS Options { 104# SEC-SIZE-NEXT: warning: '[[FILE]]': the .MIPS.options section has an invalid size (0x1) 105# SEC-SIZE-NEXT: } 106 107## Check we report a warning when the .MIPS.options description header has a size 108## that goes past the end of the section. 109 110# RUN: yaml2obj %s -DDESCSIZE=0x51 -o %t3 111# RUN: llvm-readelf -A %t3 2>&1 | FileCheck %s -DFILE=%t3 --check-prefix=DESC-SIZE 112# RUN: llvm-readobj -A %t3 2>&1 | FileCheck %s -DFILE=%t3 --check-prefix=DESC-SIZE 113 114# DESC-SIZE: IPS Options { 115# DESC-SIZE-NEXT: warning: '[[FILE]]': a descriptor of size 0x51 at offset 0x0 goes past the end of the .MIPS.options section of size 0x50 116# DESC-SIZE-NEXT: } 117 118## Check we are able to skip unsupported options and continue dumping. 119 120# RUN: yaml2obj %s -DKIND=0x2 -o %t4 121# RUN: llvm-readelf -A %t4 2>&1 | FileCheck %s -DFILE=%t4 -DTAG="ODK_EXCEPTIONS (2)" --check-prefix=KIND 122# RUN: llvm-readobj -A %t4 2>&1 | FileCheck %s -DFILE=%t4 -DTAG="ODK_EXCEPTIONS (2)" --check-prefix=KIND 123 124# RUN: yaml2obj %s -DKIND=0xFF -o %t5 125# RUN: llvm-readelf -A %t5 2>&1 | FileCheck %s -DFILE=%t5 -DTAG="Unknown (255)" --check-prefix=KIND 126# RUN: llvm-readobj -A %t5 2>&1 | FileCheck %s -DFILE=%t5 -DTAG="Unknown (255)" --check-prefix=KIND 127 128# KIND: MIPS Options { 129# KIND-NEXT: Unsupported MIPS options tag: [[TAG]] 130# KIND-NEXT: ODK_REGINFO { 131# KIND-NEXT: GP: 0x0 132# KIND-NEXT: General Mask: 0x0 133# KIND-NEXT: Co-Proc Mask0: 0x0 134# KIND-NEXT: Co-Proc Mask1: 0x0 135# KIND-NEXT: Co-Proc Mask2: 0x0 136# KIND-NEXT: Co-Proc Mask3: 0x0 137# KIND-NEXT: } 138# KIND-NEXT: } 139