[Alignment][NFC] Instructions::getLoadStoreAlignment
[llvm-complete.git] / test / tools / llvm-objcopy / ELF / localize.test
blob820ce1d5b60c49fd774563787271df3e2dc411c5
1 # RUN: yaml2obj %s > %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:     %t %t2
9 # RUN: llvm-readobj --symbols %t2 | FileCheck %s
10 # RUN: llvm-objcopy --regex --localize-symbol='.*' %t %t3
11 # RUN: cmp %t2 %t3
12 # RUN: echo "  Global # comment  " > %t-list.txt
13 # RUN: echo "GlobalUndef" >> %t-list.txt
14 # RUN: echo "Local" >> %t-list.txt
15 # RUN: echo "Weak" >> %t-list.txt
16 # RUN: echo "GlobalCommon" >> %t-list.txt
17 # RUN: echo " # comment " >> %t-list.txt
18 # RUN: llvm-objcopy --localize-symbols %t-list.txt %t %t4
19 # RUN: cmp %t2 %t4
20 # RUN: echo "  .*al.* # Global + Local + GlobalCommon " > %t-list2.txt
21 # RUN: echo "Weak" >> %t-list2.txt
22 # RUN: llvm-objcopy --regex --localize-symbols %t-list2.txt %t %t5
23 # RUN: cmp %t2 %t5
25 !ELF
26 FileHeader:
27   Class:           ELFCLASS64
28   Data:            ELFDATA2LSB
29   Type:            ET_REL
30   Machine:         EM_X86_64
31 Sections:
32   - Name:            .text
33     Type:            SHT_PROGBITS
34     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
35     Address:         0x1000
36     AddressAlign:    0x0000000000000010
37     Size:            64
38   - Name:            .data
39     Type:            SHT_PROGBITS
40     Flags:           [ SHF_ALLOC ]
41     Address:         0x2000
42     AddressAlign:    0x0000000000000010
43     Content:         "0000000000000000"
44 Symbols:
45   - Name:     Local
46     Type:     STT_FUNC
47     Section:  .text
48     Value:    0x1000
49     Size:     8
50   - Name:     Global
51     Type:     STT_FUNC
52     Size:     8
53     Section:  .text
54     Value:    0x1010
55     Binding:  STB_GLOBAL
56   - Name:     GlobalUndef
57     Type:     STT_FUNC
58     Binding:  STB_GLOBAL
59   - Name:     GlobalCommon
60     Type:     STT_OBJECT
61     Index:    SHN_COMMON
62     Value:    0x2006
63     Size:     2
64     Binding:  STB_GLOBAL
65   - Name:     Weak
66     Type:     STT_FUNC
67     Size:     8
68     Section:  .text
69     Value:    0x1008
70     Binding:  STB_WEAK
72 #CHECK: Symbols [
73 #CHECK-NEXT:  Symbol {
74 #CHECK-NEXT:    Name:
75 #CHECK-NEXT:    Value: 0x0
76 #CHECK-NEXT:    Size: 0
77 #CHECK-NEXT:    Binding: Local
78 #CHECK-NEXT:    Type: None
79 #CHECK-NEXT:    Other: 0
80 #CHECK-NEXT:    Section: Undefined
81 #CHECK-NEXT:  }
82 #CHECK-NEXT:  Symbol {
83 #CHECK-NEXT:    Name: Local
84 #CHECK-NEXT:    Value: 0x1000
85 #CHECK-NEXT:    Size: 8
86 #CHECK-NEXT:    Binding: Local
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: Global
93 #CHECK-NEXT:    Value: 0x1010
94 #CHECK-NEXT:    Size: 8
95 #CHECK-NEXT:    Binding: Local
96 #CHECK-NEXT:    Type: Function
97 #CHECK-NEXT:    Other: 0
98 #CHECK-NEXT:    Section: .text
99 #CHECK-NEXT:  }
100 #CHECK-NEXT:  Symbol {
101 #CHECK-NEXT:    Name: Weak
102 #CHECK-NEXT:    Value: 0x1008
103 #CHECK-NEXT:    Size: 8
104 #CHECK-NEXT:    Binding: Local
105 #CHECK-NEXT:    Type: Function
106 #CHECK-NEXT:    Other: 0
107 #CHECK-NEXT:    Section: .text
108 #CHECK-NEXT:  }
109 #CHECK-NEXT:  Symbol {
110 #CHECK-NEXT:    Name: GlobalUndef
111 #CHECK-NEXT:    Value:
112 #CHECK-NEXT:    Size:
113 #CHECK-NEXT:    Binding: Global
114 #CHECK-NEXT:    Type: Function
115 #CHECK-NEXT:    Other:
116 #CHECK-NEXT:    Section: Undefined
117 #CHECK-NEXT:  }
118 #CHECK-NEXT:  Symbol {
119 #CHECK-NEXT:    Name: GlobalCommon
120 #CHECK-NEXT:    Value: 0x2006
121 #CHECK-NEXT:    Size: 2
122 #CHECK-NEXT:    Binding: Global
123 #CHECK-NEXT:    Type: Object
124 #CHECK-NEXT:    Other: 0
125 #CHECK-NEXT:    Section: Common (0xF
126 #CHECK-NEXT:  }
127 #CHECK-NEXT:]