@@ -15,7 +15,7 @@ use std::sync::{Arc, Mutex};
15
15
// Implementation of this function is derived from wasmtime and is licensed under
16
16
// the Apache 2.0 license. See ATTRIBUTIONS.md for full license and more
17
17
// information.
18
- #[ linkage = "linkonce" ]
18
+ #[ cfg ( not ( feature = "generate-debug-information-no-export-symbols" ) ) ]
19
19
#[ no_mangle]
20
20
#[ inline( never) ]
21
21
extern "C" fn __jit_debug_register_code ( ) {
@@ -81,7 +81,7 @@ struct JitDebugDescriptor {
81
81
/// The data is in the form of a doubly linked list. This global variable acts
82
82
/// as a head node with extra information about the operation that we want the
83
83
/// debugger to perform.
84
- #[ linkage = "linkonce" ]
84
+ #[ cfg ( not ( feature = "generate-debug-information-no-export-symbols" ) ) ]
85
85
#[ no_mangle]
86
86
#[ allow( non_upper_case_globals) ]
87
87
static mut __jit_debug_descriptor: JitDebugDescriptor = JitDebugDescriptor {
@@ -91,6 +91,12 @@ static mut __jit_debug_descriptor: JitDebugDescriptor = JitDebugDescriptor {
91
91
first_entry : ptr:: null_mut ( ) ,
92
92
} ;
93
93
94
+ #[ cfg( feature = "generate-debug-information-no-export-symbols" ) ]
95
+ extern "C" {
96
+ static mut __jit_debug_descriptor: JitDebugDescriptor ;
97
+ fn __jit_debug_register_code ( ) ;
98
+ }
99
+
94
100
lazy_static ! {
95
101
/// Global lock on [`__jit_debug_descriptor`]. Acquire this lock when
96
102
/// reading or writing to the global variable. This includes calls to
@@ -173,12 +179,28 @@ impl Drop for JitCodeDebugInfoEntryHandleInner {
173
179
}
174
180
175
181
/// Manager of debug info registered with the debugger.
176
- #[ derive( Debug , Clone , Default ) ]
182
+ #[ derive( Debug , Clone ) ]
177
183
pub ( crate ) struct JitCodeDebugInfoManager {
178
184
inner : Vec < JitCodeDebugInfoEntryHandle > ,
179
185
}
180
186
187
+ impl Default for JitCodeDebugInfoManager {
188
+ fn default ( ) -> Self {
189
+ Self :: new ( )
190
+ }
191
+ }
192
+
181
193
impl JitCodeDebugInfoManager {
194
+ pub ( crate ) fn new ( ) -> Self {
195
+ unsafe {
196
+ // ensure we set the version, even if externally linked
197
+ __jit_debug_descriptor. version = 1 ;
198
+ }
199
+ Self {
200
+ inner : vec ! [ ] ,
201
+ }
202
+ }
203
+
182
204
/// Register debug info relating to JIT code with the debugger.
183
205
pub ( crate ) fn register_new_jit_code_entry (
184
206
& mut self ,
0 commit comments