[JITLink][arm64] Support arm64e JIT'd code (initially enabled for MachO only).
[llvm-project.git] / lld / test / ELF / cgprofile-rela.test
blob87dad02940b98b6a2855263a34440544c5687722
1 ## Under some circumstances, GNU tools strip/objcopy change REL to RELA. https://sourceware.org/bugzilla/show_bug.cgi?id=28035
2 ## Test that LLD can handle call graph profile data relocated with RELA relocations.
3 # REQUIRES: x86
5 # RUN: yaml2obj %s -o %t.o
6 # RUN: ld.lld --call-graph-profile-sort=hfsort %t.o -o %t
7 # RUN: llvm-nm --no-sort %t | FileCheck %s
8 # RUN: ld.lld --no-call-graph-profile-sort %t.o -o %t
9 # RUN: llvm-nm --no-sort %t | FileCheck %s --check-prefix=NO-CG
11 # RUN: yaml2obj -DTYPE=SHT_CREL %s -o %tcrel.o
12 # RUN: ld.lld --call-graph-profile-sort=hfsort %tcrel.o -o %t
13 # RUN: llvm-nm --no-sort %t | FileCheck %s
15 # CHECK: 0000000000201124 t D
16 # CHECK: 0000000000201122 t C
17 # CHECK: 0000000000201128 t B
18 # CHECK: 0000000000201120 t A
19 # CHECK: 0000000000201126 T _start
21 # NO-CG: 0000000000201120 t D
22 # NO-CG: 0000000000201122 t C
23 # NO-CG: 0000000000201124 t B
24 # NO-CG: 0000000000201126 t A
25 # NO-CG: 0000000000201128 T _start
27 --- !ELF
28 FileHeader:
29   Class: ELFCLASS64
30   Data:  ELFDATA2LSB
31   Type:  ET_REL
32   Machine: EM_X86_64
33 Sections:
34   - Name: .text.D
35     Type: SHT_PROGBITS
36     Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
37     Size: 2
38   - Name: .text.C
39     Type: SHT_PROGBITS
40     Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
41     Size: 2
42   - Name: .text.B
43     Type: SHT_PROGBITS
44     Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
45     Size: 2
46   - Name: .text.A
47     Type: SHT_PROGBITS
48     Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
49     Size: 2
50   - Name: .text._start
51     Type: SHT_PROGBITS
52     Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
53     Size: 2
54   - Name: .llvm.call-graph-profile
55     Type: SHT_LLVM_CALL_GRAPH_PROFILE
56     Flags: [ SHF_EXCLUDE ]
57     Link: .symtab
58     AddressAlign: 0x1
59     Entries:
60       - Weight: 10
61       - Weight: 10
62       - Weight: 80
63       - Weight: 40
64       - Weight: 30
65       - Weight: 90
66   - Name: .rela.llvm.call-graph-profile
67     Type: [[TYPE=SHT_RELA]]
68     Info: .llvm.call-graph-profile
69     Relocations:
70       - Offset: 0x0
71         Symbol: A
72         Type:   R_X86_64_NONE
73       - Offset: 0x0
74         Symbol: B
75         Type:   R_X86_64_NONE
76       - Offset: 0x8
77         Symbol: A
78         Type:   R_X86_64_NONE
79       - Offset: 0x8
80         Symbol: B
81         Type:   R_X86_64_NONE
82       - Offset: 0x10
83         Symbol: _start
84         Type:   R_X86_64_NONE
85       - Offset: 0x10
86         Symbol: B
87         Type:   R_X86_64_NONE
88       - Offset: 0x18
89         Symbol: A
90         Type:   R_X86_64_NONE
91       - Offset: 0x18
92         Symbol: C
93         Type:   R_X86_64_NONE
94       - Offset: 0x20
95         Symbol: B
96         Type:   R_X86_64_NONE
97       - Offset: 0x20
98         Symbol: C
99         Type:   R_X86_64_NONE
100       - Offset: 0x28
101         Symbol: C
102         Type:   R_X86_64_NONE
103       - Offset: 0x28
104         Symbol: D
105         Type:   R_X86_64_NONE
106 Symbols:
107   - Name: D
108     Type: STT_FUNC
109     Section: .text.D
110   - Name: C
111     Type: STT_FUNC
112     Section: .text.C
113   - Name: B
114     Type: STT_FUNC
115     Section: .text.B
116   - Name: A
117     Type: STT_FUNC
118     Section: .text.A
119   - Name: _start
120     Binding: STB_GLOBAL
121     Section: .text._start