1# RUN: yaml2obj %s -o %t
2# RUN: not llvm-objcopy -R .symtab %t %t2 2>&1 >/dev/null | FileCheck %s --check-prefix=ERR1 -DINPUT=%t
3# RUN: cp %t %t3
4# RUN: not llvm-strip --no-strip-all -R .symtab %t3 2>&1 >/dev/null | FileCheck %s --check-prefix=ERR2 -DINPUT=%t3
5
6!ELF
7FileHeader:
8  Class:           ELFCLASS64
9  Data:            ELFDATA2LSB
10  Type:            ET_REL
11  Machine:         EM_X86_64
12Sections:
13  - Name:            .text
14    Type:            SHT_PROGBITS
15    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
16    Address:         0x1000
17    AddressAlign:    0x0000000000000010
18    Content:         "0000000000000000"
19  - Name:            .rel.text
20    Type:            SHT_REL
21    Link:            .symtab
22    Info:            .text
23    Relocations:
24      - Offset: 0x1000
25        Symbol: foo
26        Type:   R_X86_64_PC32
27
28Symbols:
29  - Name:     foo
30    Type:     STT_FUNC
31    Size:     4
32    Binding:  STB_GLOBAL
33
34# ERR1: error: '[[INPUT]]': symbol table '.symtab' cannot be removed because it is referenced by the relocation section '.rel.text'
35# ERR2: error: '[[INPUT]]': symbol table '.symtab' cannot be removed because it is referenced by the relocation section '.rel.text'
36
37# RUN: llvm-objcopy --allow-broken-links -R .symtab %t %t4
38# RUN: llvm-readobj --sections %t4 | FileCheck %s --check-prefix=SECTIONS --implicit-check-not=.symtab
39# RUN: cp %t %t5
40# RUN: llvm-strip --no-strip-all --allow-broken-links -R .symtab %t5
41# RUN: llvm-readobj --sections %t5 | FileCheck %s --check-prefix=SECTIONS --implicit-check-not=.symtab
42
43# SECTIONS:        Name: .rel.text
44# SECTIONS:        Link
45# SECTIONS-SAME: : 0
46