71 lines · yaml
1## Test how yaml2obj sets the value of a symbol's st_other fields.2 3## Show that yaml2obj reports an error when using an STO_* flag that belongs4## to a different machine type to what is specified by the YAML.5 6# RUN: not yaml2obj --docnum=1 2>&1 %s | FileCheck %s --check-prefix=ERR7# ERR: error: an unknown value is used for symbol's 'Other' field: STO_MIPS_OPTIONAL8 9--- !ELF10FileHeader:11 Class: ELFCLASS3212 Data: ELFDATA2LSB13 Type: ET_REL14 Machine: EM_38615Symbols:16 - Name: foo17 Other: [ STO_MIPS_OPTIONAL ]18 19## Test that STO_* can be used with their correct machine type.20## We use the same YAML as above, but with a change of machine type.21 22# RUN: yaml2obj --docnum=2 %s -o %t223# RUN: llvm-readobj --symbols %t2 | FileCheck %s --check-prefix=USE-OTHER24 25# USE-OTHER: Name: foo26# USE-OTHER: Other [ (0x4)27# USE-OTHER-NEXT: STO_MIPS_OPTIONAL (0x4)28# USE-OTHER-NEXT: ]29 30--- !ELF31FileHeader:32 Class: ELFCLASS3233 Data: ELFDATA2LSB34 Type: ET_REL35 Machine: EM_MIPS36Symbols:37 - Name: foo38 Other: [ STO_MIPS_OPTIONAL ]39 40## Test that we can mix named and unnamed constants and set41## st_other to any arbitrary value.42 43# RUN: yaml2obj --docnum=3 %s -o %t344# RUN: llvm-readobj --symbols %t3 | FileCheck %s --check-prefix=VALUE45 46# VALUE: Name: foo47# VALUE: Other [48# VALUE-SAME: (0x4)49 50# VALUE: Name: bar51# VALUE: Other [52# VALUE-SAME: (0x7)53 54# VALUE: Name: zed55# VALUE: Other [56# VALUE-SAME: (0xFF)57 58--- !ELF59FileHeader:60 Class: ELFCLASS3261 Data: ELFDATA2LSB62 Type: ET_REL63 Machine: EM_MIPS64Symbols:65 - Name: foo66 Other: [ 0x4 ]67 - Name: bar68 Other: [ STV_PROTECTED, 4 ]69 - Name: zed70 Other: [ STV_PROTECTED, STO_MIPS_OPTIONAL, 0xf8 ]71