xref: /llvm-project/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded-all-symbols.test (revision 7f7dac712694ed661b2e774573b9ee1f99208882)
1## Stripping unneeded symbols from execuatble/DSO should
2## eliminate the static symbol table, because it's not used
3## by the dynamic loader.
4
5# RUN: yaml2obj %s -o %t.exec -DTYPE=EXEC
6# RUN: llvm-objcopy --strip-unneeded %t.exec %t2.exec
7# RUN: llvm-readobj --section-headers %t2.exec | FileCheck %s --check-prefix=NOSYMTAB
8## Validate that the symtab wouldn't be removed if the input were an ET_REL.
9# RUN: yaml2obj %s -o %t.rel -DTYPE=REL
10# RUN: llvm-objcopy --strip-unneeded %t.rel %t2.rel
11# RUN: llvm-readobj --section-headers %t2.rel | FileCheck %s --check-prefix=SYMTAB
12
13!ELF
14FileHeader:
15  Class:    ELFCLASS64
16  Data:     ELFDATA2LSB
17  Type:     ET_[[TYPE]]
18  Machine:  EM_X86_64
19Sections:
20  - Name: .text
21    Type: SHT_PROGBITS
22Symbols:
23  - Name:     local_undef
24  - Name:     local_def
25    Section:  .text
26  - Name:     global_undef
27    Binding:  STB_GLOBAL
28  - Name:     global_def
29    Section:  .text
30    Binding:  STB_GLOBAL
31
32# NOSYMTAB-NOT: .symtab
33# SYMTAB:       .symtab
34