1# RUN: yaml2obj %s -o %t.o
2# RUN: not llvm-objcopy -R .foo %t.o %t1 2>&1 >/dev/null | FileCheck %s --check-prefix=ERR1 -DINPUT=%t.o
3# RUN: cp %t.o %t2
4# RUN: not llvm-strip --no-strip-all -R .foo %t2 2>&1 >/dev/null | FileCheck %s --check-prefix=ERR2 -DINPUT=%t2
5
6--- !ELF
7FileHeader:
8  Class:           ELFCLASS64
9  Data:            ELFDATA2LSB
10  Type:            ET_REL
11  Machine:         EM_X86_64
12Sections:
13  - Name:            .foo
14    Type:            SHT_PROGBITS
15  - Name:            .bar
16    Type:            SHT_PROGBITS
17    Link:            .foo
18
19# ERR1: error: '[[INPUT]]': section '.foo' cannot be removed because it is referenced by the section '.bar'
20# ERR2: error: '[[INPUT]]': section '.foo' cannot be removed because it is referenced by the section '.bar'
21
22# RUN: llvm-objcopy --allow-broken-links -R .foo %t.o %t3
23# RUN: llvm-readobj --sections %t3 | FileCheck %s --check-prefix=SECTIONS --implicit-check-not=.foo
24# RUN: cp %t.o %t4
25# RUN: llvm-strip --no-strip-all --allow-broken-links -R .foo %t4
26# RUN: llvm-readobj --sections %t4 | FileCheck %s --check-prefix=SECTIONS --implicit-check-not=.foo
27
28# SECTIONS:      Name: .bar
29# SECTIONS:      Link
30# SECTIONS-SAME: : 0
31