1## Test how the Machine YAML field can be used to set the e_machine ELF header field.
2
3## Test we can use an arbitrary value.
4
5# RUN: yaml2obj -D MACHINE=0x1234 %s -o %t1
6# RUN: llvm-readelf %t1 --file-headers | FileCheck %s --check-prefix=UNKNOWN
7
8# UNKNOWN: Machine: 1234
9
10--- !ELF
11FileHeader:
12  Class:   ELFCLASS64
13  Data:    ELFDATA2MSB
14  Type:    ET_REL
15  Machine: [[MACHINE]]
16
17## Test we can't use a number that doesn't fit into 2 bytes.
18
19# RUN: not yaml2obj -D MACHINE=0x12345 %s 2>&1 | FileCheck %s --check-prefix=ERR
20
21# ERR: error: out of range hex16 number
22
23## Test we can use a known named constant.
24
25# RUN: yaml2obj -D MACHINE=EM_NONE %s -o %t3
26# RUN: llvm-readelf %t3 --file-headers | FileCheck %s --check-prefix=NONE
27
28# NONE: Machine: None
29
30## Test we can't use an unknown string constant.
31
32# RUN: not yaml2obj -D MACHINE=EM_UNKNOWN_FOO %s 2>&1 | FileCheck %s --check-prefix=ERR2
33
34# ERR2: error: invalid hex16 number
35