1## Test the ADDLIB MRI command.
2
3# RUN: rm -rf %t && mkdir -p %t
4# RUN: yaml2obj %s -o %t/f.o
5# RUN: llvm-ar r %t/f.a %t/f.o
6
7## Merge contents of archives.
8# RUN: echo "CREATE %t/addlib.a" > %t/addlib.mri
9# RUN: echo "ADDLIB %t/f.a" >> %t/addlib.mri
10# RUN: echo "SAVE" >> %t/addlib.mri
11# RUN: llvm-ar -M < %t/addlib.mri
12# RUN: llvm-nm --print-armap %t/addlib.a | FileCheck --check-prefix=SYMS %s
13# RUN: llvm-ar t %t/addlib.a | FileCheck --check-prefix=FILES %s
14
15# SYMS: f in {{.*}}
16# FILES: f.o
17
18## ADDLIB with non-archive file.
19# RUN: echo "CREATE %t/badlib.a" > %t/badlib.mri
20# RUN: echo "ADDLIB %s" >> %t/badlib.mri
21# RUN: echo "SAVE" >> %t/badlib.mri
22# RUN: not llvm-ar -M < %t/badlib.mri 2>&1 | FileCheck --check-prefix=PARSE %s
23# RUN: not ls %t/badlib.a
24
25# PARSE: error: script line 2: could not parse library
26
27## No create command.
28# RUN: echo "ADDLIB %t/f.a" > %t/nocreate.mri
29# RUN: echo "SAVE" >> %t/nocreate.mri
30# RUN: not llvm-ar -M < %t/nocreate.mri
31
32--- !ELF
33FileHeader:
34  Class:   ELFCLASS64
35  Data:    ELFDATA2LSB
36  Type:    ET_REL
37  Machine: EM_X86_64
38Sections:
39  - Name: .text
40    Type: SHT_PROGBITS
41Symbols:
42    - Name:    f
43      Binding: STB_GLOBAL
44      Section: .text
45...
46