1# RUN: yaml2obj %s -o %t
2# RUN: llvm-objcopy --globalize-symbol Global \
3# RUN:   --globalize-symbol Local \
4# RUN:   --globalize-symbol Weak \
5# RUN:   --globalize-symbol WeakUndef %t %t2
6# RUN: llvm-readobj --symbols %t2 | FileCheck %s
7# RUN: llvm-objcopy --regex --globalize-symbol='.*' %t %t3
8# RUN: cmp %t2 %t3
9# RUN: echo " Global # global" > %t-list.txt
10# RUN: echo "Local" >> %t-list.txt
11# RUN: echo "Weak" >> %t-list.txt
12# RUN: echo "WeakUndef" >> %t-list.txt
13# RUN: echo " # comment " >> %t-list.txt
14# RUN: llvm-objcopy --globalize-symbols %t-list.txt %t %t4
15# RUN: cmp %t2 %t4
16# RUN: echo ".+ # .+ " > %t-list2.txt
17# RUN: llvm-objcopy --regex --globalize-symbols %t-list2.txt %t %t5
18# RUN: cmp %t2 %t5
19
20!ELF
21FileHeader:
22  Class:           ELFCLASS64
23  Data:            ELFDATA2LSB
24  Type:            ET_REL
25  Machine:         EM_X86_64
26Sections:
27  - Name:            .text
28    Type:            SHT_PROGBITS
29    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
30    Address:         0x1000
31    AddressAlign:    0x0000000000000010
32    Size:            64
33Symbols:
34  - Name:     Local
35    Type:     STT_FUNC
36    Section:  .text
37    Value:    0x1000
38    Size:     8
39  - Name:     Global
40    Type:     STT_FUNC
41    Size:     8
42    Section:  .text
43    Value:    0x1010
44    Binding:  STB_GLOBAL
45  - Name:     Weak
46    Type:     STT_FUNC
47    Size:     8
48    Section:  .text
49    Value:    0x1008
50    Binding:  STB_WEAK
51  - Name:     WeakUndef
52    Binding:  STB_WEAK
53
54#CHECK: Symbols [
55#CHECK-NEXT:  Symbol {
56#CHECK-NEXT:    Name:
57#CHECK-NEXT:    Value: 0x0
58#CHECK-NEXT:    Size: 0
59#CHECK-NEXT:    Binding: Local
60#CHECK-NEXT:    Type: None
61#CHECK-NEXT:    Other: 0
62#CHECK-NEXT:    Section: Undefined
63#CHECK-NEXT:  }
64#CHECK-NEXT:  Symbol {
65#CHECK-NEXT:    Name: Local
66#CHECK-NEXT:    Value: 0x1000
67#CHECK-NEXT:    Size: 8
68#CHECK-NEXT:    Binding: Global
69#CHECK-NEXT:    Type: Function
70#CHECK-NEXT:    Other: 0
71#CHECK-NEXT:    Section: .text
72#CHECK-NEXT:  }
73#CHECK-NEXT:  Symbol {
74#CHECK-NEXT:    Name: Global
75#CHECK-NEXT:    Value: 0x1010
76#CHECK-NEXT:    Size: 8
77#CHECK-NEXT:    Binding: Global
78#CHECK-NEXT:    Type: Function
79#CHECK-NEXT:    Other: 0
80#CHECK-NEXT:    Section: .text
81#CHECK-NEXT:  }
82#CHECK-NEXT:  Symbol {
83#CHECK-NEXT:    Name: Weak
84#CHECK-NEXT:    Value: 0x1008
85#CHECK-NEXT:    Size: 8
86#CHECK-NEXT:    Binding: Global
87#CHECK-NEXT:    Type: Function
88#CHECK-NEXT:    Other: 0
89#CHECK-NEXT:    Section: .text
90#CHECK-NEXT:  }
91#CHECK-NEXT:  Symbol {
92#CHECK-NEXT:    Name: WeakUndef
93#CHECK-NEXT:    Value: 0x0
94#CHECK-NEXT:    Size: 0
95#CHECK-NEXT:    Binding: Weak
96#CHECK-NEXT:    Type: None
97#CHECK-NEXT:    Other: 0
98#CHECK-NEXT:    Section: Undefined
99#CHECK-NEXT:  }
100#CHECK-NEXT:]
101