1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/tools/llvm-ar/mri-addlib.test
Owen Reynolds 99b49538fb Reapply [llvm-ar] Include a line number when failing to parse an MRI script
Reapply r372309

Errors that occur when reading an MRI script now include a corresponding
line number.

Differential Revision: https://reviews.llvm.org/D67449

llvm-svn: 372374
2019-09-20 08:10:14 +00:00

46 lines
1.2 KiB
Plaintext

## Test the ADDLIB MRI command.
# RUN: rm -rf %t && mkdir -p %t
# RUN: yaml2obj %s -o %t/f.o
# RUN: llvm-ar r %t/f.a %t/f.o
## Merge contents of archives.
# RUN: echo "CREATE %t/addlib.a" > %t/addlib.mri
# RUN: echo "ADDLIB %t/f.a" >> %t/addlib.mri
# RUN: echo "SAVE" >> %t/addlib.mri
# RUN: llvm-ar -M < %t/addlib.mri
# RUN: llvm-nm --print-armap %t/addlib.a | FileCheck --check-prefix=SYMS %s
# RUN: llvm-ar t %t/addlib.a | FileCheck --check-prefix=FILES %s
# SYMS: f in {{.*}}
# FILES: f.o
## ADDLIB with non-archive file.
# RUN: echo "CREATE %t/badlib.a" > %t/badlib.mri
# RUN: echo "ADDLIB %s" >> %t/badlib.mri
# RUN: echo "SAVE" >> %t/badlib.mri
# RUN: not llvm-ar -M < %t/badlib.mri 2>&1 | FileCheck --check-prefix=PARSE %s
# RUN: not ls %t/badlib.a
# PARSE: error: script line 2: could not parse library
## No create command.
# RUN: echo "ADDLIB %t/f.a" > %t/nocreate.mri
# RUN: echo "SAVE" >> %t/nocreate.mri
# RUN: not llvm-ar -M < %t/nocreate.mri
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Symbols:
- Name: f
Binding: STB_GLOBAL
Section: .text
...