1# RUN: yaml2obj -D NAME= %s | llvm-nm - | FileCheck --check-prefix=FBAR %s 2# FBAR: U fbar 3 4# RUN: yaml2obj -D NAME=o %s | llvm-nm - | FileCheck --check-prefix=FOOBAR %s 5# RUN: yaml2obj -DNAME=o %s | llvm-nm - | FileCheck --check-prefix=FOOBAR %s 6# FOOBAR: U foobar 7 8# RUN: not yaml2obj -D NAME %s 2>&1 | FileCheck --check-prefix=ERR1 %s 9# ERR1: error: invalid syntax for -D: NAME 10 11# RUN: not yaml2obj -D =value %s 2>&1 | FileCheck --check-prefix=ERR2 %s 12# ERR2: error: invalid syntax for -D: =value 13 14# RUN: not yaml2obj -D NAME=a -D NAME=b %s 2>&1 | FileCheck --check-prefix=ERR3 %s 15# ERR3: error: 'NAME' redefined 16 17--- !ELF 18FileHeader: 19 Class: ELFCLASS64 20 Data: ELFDATA2LSB 21 Type: ET_REL 22 Machine: EM_X86_64 23Symbols: 24 - Name: f[[NAME]][[NAME]]bar 25 26## Digits can appear in macro names. Test that we don't expand macros recursively. 27# RUN: yaml2obj --docnum=2 -D a0='[[a1]]' -D a1='[[a0]]' %s | llvm-nm --just-symbol-name --no-sort - > %t.recur 28# RUN: echo -e '[[a1]]\n[[a0]]' > %t0.recur 29# RUN: diff -u %t0.recur %t.recur 30 31--- !ELF 32FileHeader: 33 Class: ELFCLASS64 34 Data: ELFDATA2LSB 35 Type: ET_REL 36 Machine: EM_X86_64 37Symbols: 38 - Name: "[[a0]]" 39 - Name: "[[a1]]" 40 41## Test unterminated [[. 42# RUN: yaml2obj --docnum=3 %s | llvm-nm --just-symbol-name --no-sort - > %t.nosubst 43# RUN: echo -e 'a[[\n[[a]\n[[a[[a]]\n[[a][[a]][[b]]' > %t0.nosubst 44# RUN: diff -u %t0.nosubst %t.nosubst 45 46# RUN: yaml2obj --docnum=3 -D a=b -D b=c %s | llvm-nm --just-symbol-name --no-sort - > %t.subst 47# RUN: echo -e 'a[[\n[[a]\n[[ab\n[[a]bc' > %t0.subst 48# RUN: diff -u %t0.subst %t.subst 49 50--- !ELF 51FileHeader: 52 Class: ELFCLASS64 53 Data: ELFDATA2LSB 54 Type: ET_REL 55 Machine: EM_X86_64 56Symbols: 57 - Name: "a[[" 58 - Name: "[[a]" 59 - Name: "[[a[[a]]" 60 - Name: "[[a][[a]][[b]]" 61 62## Check that it is possible to set a default value for a macro in the YAML description. 63## Check that we are able to provide an empty default value for a macro. 64# RUN: yaml2obj --docnum=4 %s -o %t4.1 65# RUN: llvm-nm --no-sort %t4.1 | FileCheck %s --check-prefix=DEFAULT 66 67# DEFAULT: U _foo_ 68# DEFAULT-NEXT: U __ 69 70--- !ELF 71FileHeader: 72 Class: ELFCLASS64 73 Data: ELFDATA2LSB 74 Type: ET_REL 75 Machine: EM_X86_64 76Symbols: 77 - Name: _[[FOO=foo]]_ 78 - Name: _[[BAR=]]_ 79 80## Check that it is possible to override a default macro value. 81# RUN: yaml2obj --docnum=4 %s -o %t4.2 -DFOO=bar -DBAR=foo 82# RUN: llvm-nm --no-sort %t4.2 | FileCheck %s --check-prefix=OVERRIDE-DEFAULT1 83 84# OVERRIDE-DEFAULT1: U _bar_ 85# OVERRIDE-DEFAULT1-NEXT: U _foo_ 86 87# RUN: yaml2obj --docnum=4 %s -o %t4.3 -DFOO=bar=foo -DBAR=foo=bar 88# RUN: llvm-nm --no-sort %t4.3 | FileCheck %s --check-prefix=OVERRIDE-DEFAULT2 89 90# OVERRIDE-DEFAULT2: U _bar=foo_ 91# OVERRIDE-DEFAULT2-NEXT: U _foo=bar_ 92