xref: /llvm-project/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded-aarch64.test (revision f3471dc517696b3dcd9a3f3c2c0642dfff499776)
1## Check that llvm-objcopy preserves AArch64 mapping symbols for relocatable files.
2# RUN: yaml2obj %s -o %t.o -DTYPE=REL
3# RUN: llvm-objcopy --strip-unneeded %t.o %t1.o
4# RUN: llvm-nm -j --special-syms %t1.o | FileCheck %s --match-full-lines
5# RUN: llvm-objcopy --discard-all %t.o %t2.o
6# RUN: llvm-nm -j --special-syms %t2.o | FileCheck %s --match-full-lines
7
8# CHECK:      $d
9# CHECK-NEXT: $d.d
10# CHECK-NEXT: $x
11# CHECK-NEXT: $x.x
12
13## A mapping symbol can be deleted if specified explicitly.
14# RUN: llvm-objcopy -w -N '$d*' %t.o %t3.o
15# RUN: llvm-nm --special-syms %t3.o | FileCheck /dev/null --implicit-check-not='$d'
16
17## Mapping symbols are not preserved for executable files
18# RUN: yaml2obj %s -o %t.exec -DTYPE=EXEC
19# RUN: llvm-objcopy --strip-unneeded %t.exec %t1.exec
20# RUN: llvm-nm --special-syms %t1.exec | count 0
21
22# RUN: yaml2obj %s -o %t.so -DTYPE=DYN
23# RUN: llvm-objcopy --strip-unneeded %t.so %t1.so
24# RUN: llvm-nm --special-syms %t1.so | count 0
25
26!ELF
27FileHeader:
28  Class:    ELFCLASS64
29  Data:     ELFDATA2LSB
30  Type:     ET_[[TYPE]]
31  Machine:  EM_AARCH64
32Sections:
33  - Name: .text
34    Type: SHT_PROGBITS
35Symbols:
36  - Name:     $a
37    Section:  .text
38  - Name:     $d
39    Section:  .text
40  - Name:     $dd
41    Section:  .text
42  - Name:     $d.d
43    Section:  .text
44  - Name:     $m
45    Section:  .text
46  - Name:     $t.t
47    Section:  .text
48  - Name:     $x
49    Section:  .text
50  - Name:     $xx
51    Section:  .text
52  - Name:     $x.x
53    Section:  .text
54