## Validate MSPABI ELF Build Attributes ## The header of .MSP430.attributes can be specified with. ## ContentArray: [ 0x41, 0x16, 0x00, 0x00, 0x00, 0x6D, 0x73, 0x70, 0x61, 0x62, ## 0x69, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, ## ## Following that are individual bytes describing the ISA, code model, data ## model and optionally enum size. ## ## If enum size is being tested, then the second byte (indicating the length of ## the section), and last 32-bit int (indicating the length of the ## subsection) of the header should be incremented by 2. This is to account for ## the additional bytes for the enum size tag and value. # HEADER: BuildAttributes { # HEADER-NEXT: FormatVersion: 0x41 # HEADER-NEXT: Section 1 { # HEADER-NEXT: SectionLength: 22 # HEADER-NEXT: Vendor: mspabi # HEADER-NEXT: Tag: Tag_File (0x1) # HEADER-NEXT: Size: 11 # ENUM-HEADER: BuildAttributes { # ENUM-HEADER-NEXT: FormatVersion: 0x41 # ENUM-HEADER-NEXT: Section 1 { # ENUM-HEADER-NEXT: SectionLength: 24 # ENUM-HEADER-NEXT: Vendor: mspabi # ENUM-HEADER-NEXT: Tag: Tag_File (0x1) # ENUM-HEADER-NEXT: Size: 13 # MSP430: Tag: 4 # MSP430-NEXT: Value: 1 # MSP430-NEXT: TagName: ISA # MSP430-NEXT: Description: MSP430 # MSP430X: Tag: 4 # MSP430X-NEXT: Value: 2 # MSP430X-NEXT: TagName: ISA # MSP430X-NEXT: Description: MSP430X # SMALL-CODE: Tag: 6 # SMALL-CODE-NEXT: Value: 1 # SMALL-CODE-NEXT: TagName: Code_Model # SMALL-CODE-NEXT: Description: Small # LARGE-CODE: Tag: 6 # LARGE-CODE-NEXT: Value: 2 # LARGE-CODE-NEXT: TagName: Code_Model # LARGE-CODE-NEXT: Description: Large # SMALL-DATA: Tag: 8 # SMALL-DATA-NEXT: Value: 1 # SMALL-DATA-NEXT: TagName: Data_Model # SMALL-DATA-NEXT: Description: Small # LARGE-DATA: Tag: 8 # LARGE-DATA-NEXT: Value: 2 # LARGE-DATA-NEXT: TagName: Data_Model # LARGE-DATA-NEXT: Description: Large # RESTRICTED-DATA: Tag: 8 # RESTRICTED-DATA-NEXT: Value: 3 # RESTRICTED-DATA-NEXT: TagName: Data_Model # RESTRICTED-DATA-NEXT: Description: Restricted # SMALL-ENUM: Tag: 10 # SMALL-ENUM-NEXT: Value: 1 # SMALL-ENUM-NEXT: TagName: Enum_Size # SMALL-ENUM-NEXT: Description: Small # INTEGER-ENUM: Tag: 10 # INTEGER-ENUM-NEXT: Value: 2 # INTEGER-ENUM-NEXT: TagName: Enum_Size # INTEGER-ENUM-NEXT: Description: Integer # DONT-CARE-ENUM: Tag: 10 # DONT-CARE-ENUM-NEXT: Value: 3 # DONT-CARE-ENUM-NEXT: TagName: Enum_Size # DONT-CARE-ENUM-NEXT: Description: Don't Care ## MSP430 ISA # RUN: yaml2obj --docnum=1 %s -o %t.o # RUN: llvm-readobj -A %t.o | FileCheck %s --check-prefixes HEADER,MSP430,SMALL-CODE,SMALL-DATA --- !ELF FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: EM_MSP430 Sections: - Name: .MSP430.attributes Type: SHT_MSP430_ATTRIBUTES ContentArray: [ 0x41, 0x16, 0x00, 0x00, 0x00, 0x6D, 0x73, 0x70, 0x61, 0x62, 0x69, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x01, 0x06, 0x01, 0x08, 0x01 ] ## MSP430X ISA, Small Code Model, Small Data Model # RUN: yaml2obj --docnum=2 %s -o %t.o # RUN: llvm-readobj -A %t.o | FileCheck %s --check-prefixes HEADER,MSP430X,SMALL-CODE,SMALL-DATA --- !ELF FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: EM_MSP430 Sections: - Name: .MSP430.attributes Type: SHT_MSP430_ATTRIBUTES ContentArray: [ 0x41, 0x16, 0x00, 0x00, 0x00, 0x6D, 0x73, 0x70, 0x61, 0x62, 0x69, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x02, 0x06, 0x01, 0x08, 0x01 ] ## MSP430X Large Code Model, Small Data Model # RUN: yaml2obj --docnum=3 %s -o %t.o # RUN: llvm-readobj -A %t.o | FileCheck %s --check-prefixes HEADER,MSP430X,LARGE-CODE,SMALL-DATA --- !ELF FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: EM_MSP430 Sections: - Name: .MSP430.attributes Type: SHT_MSP430_ATTRIBUTES ContentArray: [ 0x41, 0x16, 0x00, 0x00, 0x00, 0x6D, 0x73, 0x70, 0x61, 0x62, 0x69, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x02, 0x06, 0x02, 0x08, 0x01 ] ## MSP430X Small Code Model, Large Data Model # RUN: yaml2obj --docnum=4 %s -o %t.o # RUN: llvm-readobj -A %t.o | FileCheck %s --check-prefixes HEADER,MSP430X,SMALL-CODE,LARGE-DATA --- !ELF FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: EM_MSP430 Sections: - Name: .MSP430.attributes Type: SHT_MSP430_ATTRIBUTES ContentArray: [ 0x41, 0x16, 0x00, 0x00, 0x00, 0x6D, 0x73, 0x70, 0x61, 0x62, 0x69, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x02, 0x06, 0x01, 0x08, 0x02 ] ## MSP430X Small Code Model, Restricted Data Model # RUN: yaml2obj --docnum=5 %s -o %t.o # RUN: llvm-readobj -A %t.o | FileCheck %s --check-prefixes HEADER,MSP430X,SMALL-CODE,RESTRICTED-DATA --- !ELF FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: EM_MSP430 Sections: - Name: .MSP430.attributes Type: SHT_MSP430_ATTRIBUTES ContentArray: [ 0x41, 0x16, 0x00, 0x00, 0x00, 0x6D, 0x73, 0x70, 0x61, 0x62, 0x69, 0x00, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x02, 0x06, 0x01, 0x08, 0x03 ] ## MSP430X Small Code Model, Small Data Model, Small Enums # RUN: yaml2obj --docnum=6 %s -o %t.o # RUN: llvm-readobj -A %t.o | FileCheck %s --check-prefixes ENUM-HEADER,MSP430X,SMALL-CODE,SMALL-DATA,SMALL-ENUM --- !ELF FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: EM_MSP430 Sections: - Name: .MSP430.attributes Type: SHT_MSP430_ATTRIBUTES ContentArray: [ 0x41, 0x18, 0x00, 0x00, 0x00, 0x6D, 0x73, 0x70, 0x61, 0x62, 0x69, 0x00, 0x01, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x02, 0x06, 0x01, 0x08, 0x01, 0x0a, 0x01 ] ## MSP430X Small Code Model, Small Data Model, Integer Enums # RUN: yaml2obj --docnum=7 %s -o %t.o # RUN: llvm-readobj -A %t.o | FileCheck %s --check-prefixes ENUM-HEADER,MSP430X,SMALL-CODE,SMALL-DATA,INTEGER-ENUM --- !ELF FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: EM_MSP430 Sections: - Name: .MSP430.attributes Type: SHT_MSP430_ATTRIBUTES ContentArray: [ 0x41, 0x18, 0x00, 0x00, 0x00, 0x6D, 0x73, 0x70, 0x61, 0x62, 0x69, 0x00, 0x01, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x02, 0x06, 0x01, 0x08, 0x01, 0x0a, 0x02 ] ## MSP430X Small Code Model, Small Data Model, "Don't Care" Enums # RUN: yaml2obj --docnum=8 %s -o %t.o # RUN: llvm-readobj -A %t.o | FileCheck %s --check-prefixes ENUM-HEADER,MSP430X,SMALL-CODE,SMALL-DATA,DONT-CARE-ENUM --- !ELF FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: EM_MSP430 Sections: - Name: .MSP430.attributes Type: SHT_MSP430_ATTRIBUTES ContentArray: [ 0x41, 0x18, 0x00, 0x00, 0x00, 0x6D, 0x73, 0x70, 0x61, 0x62, 0x69, 0x00, 0x01, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x02, 0x06, 0x01, 0x08, 0x01, 0x0a, 0x03 ]