Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / llvm-objcopy / ELF / localize.test
blob97252fbd1689559101e5d93d7570cc4d4244b3f0
1 # RUN: yaml2obj %s -o %t
2 # RUN: llvm-objcopy \
3 # RUN:     --localize-symbol Global \
4 # RUN:     -L GlobalUndef \
5 # RUN:     -L Local \
6 # RUN:     -L Weak \
7 # RUN:     -L GlobalCommon \
8 # RUN:     -L Missing \
9 # RUN:     %t %t2
10 # RUN: llvm-readobj --symbols %t2 | FileCheck %s
11 # RUN: llvm-objcopy --regex --localize-symbol='[GLW].*' %t %t3
12 # RUN: cmp %t2 %t3
13 # RUN: echo "  Global # comment  " > %t-list.txt
14 # RUN: echo "GlobalUndef" >> %t-list.txt
15 # RUN: echo "Local" >> %t-list.txt
16 # RUN: echo "Weak" >> %t-list.txt
17 # RUN: echo "GlobalCommon" >> %t-list.txt
18 # RUN: echo "Missing" >> %t-list.txt
19 # RUN: echo " # comment " >> %t-list.txt
20 # RUN: llvm-objcopy --localize-symbols %t-list.txt %t %t4
21 # RUN: cmp %t2 %t4
22 # RUN: echo "  .*al.* # Global + Local + GlobalCommon " > %t-list2.txt
23 # RUN: echo "Weak" >> %t-list2.txt
24 # RUN: llvm-objcopy --regex --localize-symbols %t-list2.txt %t %t5
25 # RUN: cmp %t2 %t5
27 !ELF
28 FileHeader:
29   Class:           ELFCLASS64
30   Data:            ELFDATA2LSB
31   Type:            ET_REL
32   Machine:         EM_X86_64
33 Sections:
34   - Name:            .text
35     Type:            SHT_PROGBITS
36     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
37     Address:         0x1000
38     AddressAlign:    0x0000000000000010
39     Size:            64
40   - Name:            .data
41     Type:            SHT_PROGBITS
42     Flags:           [ SHF_ALLOC ]
43     Address:         0x2000
44     AddressAlign:    0x0000000000000010
45     Content:         "0000000000000000"
46 Symbols:
47   - Name:     Local
48     Type:     STT_FUNC
49     Section:  .text
50     Value:    0x1000
51     Size:     8
52   - Name:     Global
53     Type:     STT_FUNC
54     Size:     8
55     Section:  .text
56     Value:    0x1010
57     Binding:  STB_GLOBAL
58   - Name:     GlobalUndef
59     Type:     STT_FUNC
60     Binding:  STB_GLOBAL
61   - Name:     GlobalCommon
62     Type:     STT_OBJECT
63     Index:    SHN_COMMON
64     Value:    0x2006
65     Size:     2
66     Binding:  STB_GLOBAL
67   - Name:     Weak
68     Type:     STT_FUNC
69     Size:     8
70     Section:  .text
71     Value:    0x1008
72     Binding:  STB_WEAK
73   - Name:     Unmentioned
74     Section:  .text
75     Binding:  STB_GLOBAL
77 #CHECK: Symbols [
78 #CHECK-NEXT:  Symbol {
79 #CHECK-NEXT:    Name:
80 #CHECK-NEXT:    Value: 0x0
81 #CHECK-NEXT:    Size: 0
82 #CHECK-NEXT:    Binding: Local
83 #CHECK-NEXT:    Type: None
84 #CHECK-NEXT:    Other: 0
85 #CHECK-NEXT:    Section: Undefined
86 #CHECK-NEXT:  }
87 #CHECK-NEXT:  Symbol {
88 #CHECK-NEXT:    Name: Local
89 #CHECK-NEXT:    Value: 0x1000
90 #CHECK-NEXT:    Size: 8
91 #CHECK-NEXT:    Binding: Local
92 #CHECK-NEXT:    Type: Function
93 #CHECK-NEXT:    Other: 0
94 #CHECK-NEXT:    Section: .text
95 #CHECK-NEXT:  }
96 #CHECK-NEXT:  Symbol {
97 #CHECK-NEXT:    Name: Global
98 #CHECK-NEXT:    Value: 0x1010
99 #CHECK-NEXT:    Size: 8
100 #CHECK-NEXT:    Binding: Local
101 #CHECK-NEXT:    Type: Function
102 #CHECK-NEXT:    Other: 0
103 #CHECK-NEXT:    Section: .text
104 #CHECK-NEXT:  }
105 #CHECK-NEXT:  Symbol {
106 #CHECK-NEXT:    Name: Weak
107 #CHECK-NEXT:    Value: 0x1008
108 #CHECK-NEXT:    Size: 8
109 #CHECK-NEXT:    Binding: Local
110 #CHECK-NEXT:    Type: Function
111 #CHECK-NEXT:    Other: 0
112 #CHECK-NEXT:    Section: .text
113 #CHECK-NEXT:  }
114 #CHECK-NEXT:  Symbol {
115 #CHECK-NEXT:    Name: GlobalUndef
116 #CHECK-NEXT:    Value:
117 #CHECK-NEXT:    Size:
118 #CHECK-NEXT:    Binding: Global
119 #CHECK-NEXT:    Type: Function
120 #CHECK-NEXT:    Other:
121 #CHECK-NEXT:    Section: Undefined
122 #CHECK-NEXT:  }
123 #CHECK-NEXT:  Symbol {
124 #CHECK-NEXT:    Name: GlobalCommon
125 #CHECK-NEXT:    Value: 0x2006
126 #CHECK-NEXT:    Size: 2
127 #CHECK-NEXT:    Binding: Global
128 #CHECK-NEXT:    Type: Object
129 #CHECK-NEXT:    Other: 0
130 #CHECK-NEXT:    Section: Common
131 #CHECK-NEXT:  }
132 #CHECK-NEXT:  Symbol {
133 #CHECK-NEXT:    Name: Unmentioned
134 #CHECK-NEXT:    Value:
135 #CHECK-NEXT:    Size:
136 #CHECK-NEXT:    Binding: Global
137 #CHECK-NEXT:    Type:
138 #CHECK-NEXT:    Other:
139 #CHECK-NEXT:    Section: .text
140 #CHECK-NEXT:  }
141 #CHECK-NEXT:]