File: discard-mix-local-and-all.test

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (106 lines) | stat: -rw-r--r-- 3,887 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# RUN: yaml2obj %s -o %t
# Establish baseline objects for further checks. --discard-locals only discards
# compiler-generated local symbols (starting with .L), --discard-all discards
# all regular local symbols.
# RUN: llvm-objcopy %t %t-discard-none
# RUN: llvm-readobj --symbols %t-discard-none | FileCheck %s --check-prefixes=CHECK,LOCAL,COMPILER-LOCAL
# RUN: llvm-objcopy --discard-all %t %t-discard-all
# RUN: llvm-readobj --symbols %t-discard-all | FileCheck %s
# RUN: llvm-objcopy --discard-locals %t %t-discard-locals
# RUN: llvm-readobj --symbols %t-discard-locals | FileCheck %s --check-prefixes=CHECK,LOCAL

# When mixing --discard-all and --discard-locals, the last one wins.
# RUN: llvm-objcopy --discard-all --discard-locals %t %t.1.o
# RUN: cmp %t.1.o %t-discard-locals
# RUN: llvm-objcopy --discard-locals --discard-all %t %t.2.o
# RUN: cmp %t.2.o %t-discard-all
# RUN: llvm-objcopy -x -X %t %t.3.o
# RUN: cmp %t.3.o %t-discard-locals
# RUN: llvm-objcopy -X -x %t %t.4.o
# RUN: cmp %t.4.o %t-discard-all
# RUN: llvm-objcopy -x -X -x -X %t %t.5.o
# RUN: cmp %t.5.o %t-discard-locals
# RUN: llvm-objcopy -X -x -X -x %t %t.6.o
# RUN: cmp %t.6.o %t-discard-all
# RUN: llvm-objcopy -X -x -X -x --discard-locals %t %t.7.o
# RUN: cmp %t.7.o %t-discard-locals
# RUN: llvm-objcopy -X -x -X -x --discard-all %t %t.8.o
# RUN: cmp %t.8.o %t-discard-all

# llvm-strip works in the same way.
# RUN: llvm-strip --discard-all --discard-locals %t -o %t.9.o
# RUN: cmp %t.9.o %t-discard-locals
# RUN: llvm-strip --discard-locals --discard-all %t -o %t.10.o
# RUN: cmp %t.10.o %t-discard-all
# RUN: llvm-strip -x -X %t -o %t.11.o
# RUN: cmp %t.11.o %t-discard-locals
# RUN: llvm-strip -X -x %t -o %t.12.o
# RUN: cmp %t.12.o %t-discard-all
# RUN: llvm-strip -x -X -x -X %t -o %t.13.o
# RUN: cmp %t.13.o %t-discard-locals
# RUN: llvm-strip -X -x -X -x %t -o %t.14.o
# RUN: cmp %t.14.o %t-discard-all
# RUN: llvm-strip -X -x -X -x --discard-locals %t -o %t.15.o
# RUN: cmp %t.15.o %t-discard-locals
# RUN: llvm-strip -X -x -X -x --discard-all %t -o %t.16.o
# RUN: cmp %t.16.o %t-discard-all

!ELF
FileHeader:
  Class:           ELFCLASS64
  Data:            ELFDATA2LSB
  Type:            ET_REL
  Machine:         EM_X86_64
Sections:
  - Name:            .text
    Type:            SHT_PROGBITS
Symbols:
  - Name:     Local
    Type:     STT_FUNC
    Section:  .text
  - Name:     .L.str
    Type:     STT_OBJECT
    Section:  .text
  - Name:     Global
    Type:     STT_FUNC
    Section:  .text
    Binding:  STB_GLOBAL

# CHECK:               Symbols [
# CHECK-NEXT:            Symbol {
# CHECK-NEXT:              Name:
# CHECK-NEXT:              Value: 0x0
# CHECK-NEXT:              Size: 0
# CHECK-NEXT:              Binding: Local
# CHECK-NEXT:              Type: None
# CHECK-NEXT:              Other: 0
# CHECK-NEXT:              Section: Undefined
# CHECK-NEXT:            }
# LOCAL-NEXT:            Symbol {
# LOCAL-NEXT:              Name: Local
# LOCAL-NEXT:              Value:
# LOCAL-NEXT:              Size:
# LOCAL-NEXT:              Binding: Local
# LOCAL-NEXT:              Type: Function
# LOCAL-NEXT:              Other:
# LOCAL-NEXT:              Section: .text
# LOCAL-NEXT:            }
# COMPILER-LOCAL-NEXT:   Symbol {
# COMPILER-LOCAL-NEXT:     Name: .L.str
# COMPILER-LOCAL-NEXT:     Value:
# COMPILER-LOCAL-NEXT:     Size:
# COMPILER-LOCAL-NEXT:     Binding: Local
# COMPILER-LOCAL-NEXT:     Type: Object
# COMPILER-LOCAL-NEXT:     Other:
# COMPILER-LOCAL-NEXT:     Section: .text
# COMPILER-LOCAL-NEXT:   }
# CHECK-NEXT:            Symbol {
# CHECK-NEXT:              Name: Global
# CHECK-NEXT:              Value:
# CHECK-NEXT:              Size:
# CHECK-NEXT:              Binding: Global
# CHECK-NEXT:              Type: Function
# CHECK-NEXT:              Other:
# CHECK-NEXT:              Section: .text
# CHECK-NEXT:            }
# CHECK-NEXT:          ]