File tree 2 files changed +5
-7
lines changed
2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,10 @@ extern {
17
17
// Do not remove inline: will result in relocation failure
18
18
// For the same reason we use inline ASM here instead of an extern static to
19
19
// locate the base
20
+ /// Returns address at which current enclave is loaded.
20
21
#[ inline( always) ]
21
- fn image_base ( ) -> u64 {
22
+ #[ unstable( feature = "sgx_platform" , issue = "56975" ) ]
23
+ pub fn image_base ( ) -> u64 {
22
24
let base;
23
25
unsafe { asm ! ( "lea IMAGE_BASE(%rip),$0" : "=r" ( base) ) } ;
24
26
base
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use error::Error;
3
3
use libc;
4
4
use sys_common:: backtrace:: Frame ;
5
5
use unwind as uw;
6
+ use sys:: sgx:: abi:: mem:: image_base;
6
7
7
8
pub struct BacktraceContext ;
8
9
@@ -75,11 +76,6 @@ extern "C" fn trace_fn(
75
76
uw:: _URC_NO_REASON
76
77
}
77
78
78
- extern {
79
- static IMAGE_BASE : u8 ;
80
- }
81
-
82
-
83
79
// To reduce TCB size in Sgx enclave, we do not want to implement resolve_symname functionality.
84
80
// Rather, we print the offset of the address here, which could be later mapped to correct function.
85
81
pub fn resolve_symname < F > ( frame : Frame ,
@@ -88,7 +84,7 @@ pub fn resolve_symname<F>(frame: Frame,
88
84
where F : FnOnce ( Option < & str > ) -> io:: Result < ( ) >
89
85
{
90
86
callback ( Some ( & format ! ( "0x{:x}" ,
91
- ( unsafe { frame. symbol_addr. wrapping_offset_from( & IMAGE_BASE ) } ) ) ) )
87
+ ( frame. symbol_addr. wrapping_offset_from( image_base ( ) as _ ) ) ) ) )
92
88
}
93
89
94
90
pub fn foreach_symbol_fileline < F > ( _: Frame ,
You can’t perform that action at this time.
0 commit comments