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