xref: /llvm-project/llvm/test/tools/llvm-objcopy/ELF/strip-unneeded-arm.test (revision f3471dc517696b3dcd9a3f3c2c0642dfff499776)
1*f3471dc5SIgor Kudrin## Check that llvm-objcopy preserves ARM 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:      $a
9*f3471dc5SIgor Kudrin# CHECK-NEXT: $a.a
10*f3471dc5SIgor Kudrin# CHECK-NEXT: $d
11*f3471dc5SIgor Kudrin# CHECK-NEXT: $d.d
12*f3471dc5SIgor Kudrin# CHECK-NEXT: $t
13*f3471dc5SIgor Kudrin# CHECK-NEXT: $t.t
14*f3471dc5SIgor Kudrin# CHECK-NOT:  $x
15*f3471dc5SIgor Kudrin
16*f3471dc5SIgor Kudrin## A mapping symbol can be deleted if specified explicitly.
17*f3471dc5SIgor Kudrin# RUN: llvm-objcopy -w -N '$d*' %t.o %t3.o
18*f3471dc5SIgor Kudrin# RUN: llvm-nm --special-syms %t3.o | FileCheck /dev/null --implicit-check-not='$d'
19*f3471dc5SIgor Kudrin
20*f3471dc5SIgor Kudrin## Mapping symbols are not preserved for executable files
21*f3471dc5SIgor Kudrin# RUN: yaml2obj %s -o %t.exec -DTYPE=EXEC
22*f3471dc5SIgor Kudrin# RUN: llvm-objcopy --strip-unneeded %t.exec %t1.exec
23*f3471dc5SIgor Kudrin# RUN: llvm-nm --special-syms %t1.exec | count 0
24*f3471dc5SIgor Kudrin
25*f3471dc5SIgor Kudrin# RUN: yaml2obj %s -o %t.so -DTYPE=DYN
26*f3471dc5SIgor Kudrin# RUN: llvm-objcopy --strip-unneeded %t.so %t1.so
27*f3471dc5SIgor Kudrin# RUN: llvm-nm --special-syms %t1.so | count 0
28*f3471dc5SIgor Kudrin
29*f3471dc5SIgor Kudrin!ELF
30*f3471dc5SIgor KudrinFileHeader:
31*f3471dc5SIgor Kudrin  Class:    ELFCLASS32
32*f3471dc5SIgor Kudrin  Data:     ELFDATA2LSB
33*f3471dc5SIgor Kudrin  Type:     ET_[[TYPE]]
34*f3471dc5SIgor Kudrin  Machine:  EM_ARM
35*f3471dc5SIgor KudrinSections:
36*f3471dc5SIgor Kudrin  - Name: .text
37*f3471dc5SIgor Kudrin    Type: SHT_PROGBITS
38*f3471dc5SIgor KudrinSymbols:
39*f3471dc5SIgor Kudrin  - Name:     $a
40*f3471dc5SIgor Kudrin    Section:  .text
41*f3471dc5SIgor Kudrin  - Name:     $aa
42*f3471dc5SIgor Kudrin    Section:  .text
43*f3471dc5SIgor Kudrin  - Name:     $a.a
44*f3471dc5SIgor Kudrin    Section:  .text
45*f3471dc5SIgor Kudrin  - Name:     $d
46*f3471dc5SIgor Kudrin    Section:  .text
47*f3471dc5SIgor Kudrin  - Name:     $dd
48*f3471dc5SIgor Kudrin    Section:  .text
49*f3471dc5SIgor Kudrin  - Name:     $d.d
50*f3471dc5SIgor Kudrin    Section:  .text
51*f3471dc5SIgor Kudrin  - Name:     $m
52*f3471dc5SIgor Kudrin    Section:  .text
53*f3471dc5SIgor Kudrin  - Name:     $t
54*f3471dc5SIgor Kudrin    Section:  .text
55*f3471dc5SIgor Kudrin  - Name:     $tt
56*f3471dc5SIgor Kudrin    Section:  .text
57*f3471dc5SIgor Kudrin  - Name:     $t.t
58*f3471dc5SIgor Kudrin    Section:  .text
59*f3471dc5SIgor Kudrin  - Name:     $x
60*f3471dc5SIgor Kudrin    Section:  .text
61