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