• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Show that the archive library emits error messages when adding malformed
2## objects.
3
4# RUN: rm -rf %t.dir
5# RUN: split-file %s %t.dir
6# RUN: cd %t.dir
7
8## Malformed bitcode object.
9# RUN: llvm-as input.ll -o input.bc
10# RUN: %python -c "with open('input.bc', 'a') as f: f.truncate(10)"
11# RUN: not llvm-ar rc bad.a input.bc 2>&1 | FileCheck %s --check-prefix=ERR1
12
13# ERR1: error: bad.a: Invalid bitcode signature
14
15## Non-bitcode malformed file.
16# RUN: yaml2obj input.yaml -o input.o
17# RUN: not llvm-ar rc bad.a input.o 2>&1 | FileCheck %s --check-prefix=ERR2
18
19# ERR2: error: bad.a: section header table goes past the end of the file: e_shoff = 0x9999
20
21## Don't emit an error if the symbol table is not required.
22# RUN: llvm-ar rcS good.a input.o input.bc
23# RUN: llvm-ar t good.a | FileCheck %s --check-prefix=CONTENTS
24
25# CONTENTS:      input.o
26# CONTENTS-NEXT: input.bc
27
28#--- input.ll
29target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
30target triple = "x86_64-pc-linux"
31
32#--- input.yaml
33--- !ELF
34FileHeader:
35  Class:   ELFCLASS64
36  Data:    ELFDATA2LSB
37  Type:    ET_REL
38  EShOff:  0x9999
39