1## Check that we are able to dump the SHT_MIPS_REGINFO section using -A properly.
2
3# RUN: yaml2obj --docnum=1 %s -o %t1
4# RUN: llvm-readobj -A %t1 | FileCheck %s --check-prefix=OPTIONS
5# RUN: llvm-readelf -A %t1 | FileCheck %s --check-prefix=OPTIONS
6
7# OPTIONS:      MIPS RegInfo {
8# OPTIONS-NEXT:   GP:            0x807060504030201
9# OPTIONS-NEXT:   General Mask:  0xD0C0B0A
10# OPTIONS-NEXT:   Co-Proc Mask0: 0x88776655
11# OPTIONS-NEXT:   Co-Proc Mask1: 0xCCBBAA99
12# OPTIONS-NEXT:   Co-Proc Mask2: 0x1EFFEEDD
13# OPTIONS-NEXT:   Co-Proc Mask3: 0x5E4E3E2E
14# OPTIONS-NEXT: }
15
16--- !ELF
17FileHeader:
18  Class:   ELFCLASS64
19  Data:    ELFDATA2LSB
20  Type:    ET_REL
21  Machine: EM_MIPS
22Sections:
23  - Name: .reginfo
24    Type: SHT_MIPS_REGINFO
25    ContentArray: [ 0xA, 0xB, 0xC, 0xD,     ## Bit-mask of used general registers.
26                    0x11, 0x22, 0x33, 0x44, ## Unused padding field.
27                    0x55, 0x66, 0x77, 0x88, ## Bit-mask of used co-processor registers (0).
28                    0x99, 0xAA, 0xBB, 0xCC, ## Bit-mask of used co-processor registers (1).
29                    0xDD, 0xEE, 0xFF, 0x1E, ## Bit-mask of used co-processor registers (2).
30                    0x2E, 0x3E, 0x4E, 0x5E, ## Bit-mask of used co-processor registers (3).
31                    0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8 ] ## GP register value.
32
33## Check that we try to dump the .reginfo section when we are able to locate it by name.
34# RUN: yaml2obj --docnum=2 -DNAME=0xffff %s -o %t.err1
35# RUN: llvm-readelf -A %t.err1 2>&1 | \
36# RUN:   FileCheck %s -DFILE=%t.err1 --check-prefix=NAME-ERR-FOUND --implicit-check-not=warning:
37# RUN: llvm-readobj -A %t.err1 2>&1 | \
38# RUN:   FileCheck %s -DFILE=%t.err1 --check-prefix=NAME-ERR-FOUND --implicit-check-not=warning:
39
40# 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
41# 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
42# NAME-ERR-FOUND:      warning: '[[FILE]]': the .reginfo section has an invalid size (0x0)
43
44--- !ELF
45FileHeader:
46  Class:   ELFCLASS64
47  Data:    ELFDATA2LSB
48  Type:    ET_REL
49  Machine: EM_MIPS
50Sections:
51  - Type:   SHT_PROGBITS
52    ShName: [[NAME=<none>]]
53  - Name:   .reginfo
54    Type:   SHT_MIPS_REGINFO
55    ShName: [[REGINFONAME=<none>]]
56  - Type:   SHT_PROGBITS
57    ShName: [[NAME=<none>]]
58
59## Check we report a warning when we are unable to find the .reginfo section due to an error.
60# RUN: yaml2obj --docnum=2 -DREGINFONAME=0xffff %s -o %t.err2
61# RUN: llvm-readelf -A %t.err2 2>&1 | \
62# RUN:   FileCheck %s -DFILE=%t.err2 --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning:
63# RUN: llvm-readobj -A %t.err2 2>&1 | \
64# RUN:   FileCheck %s -DFILE=%t.err2 --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning:
65
66# NAME-ERR-NOTFOUND: warning: '[[FILE]]': unable to read the name of SHT_MIPS_REGINFO 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
67