File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,10 @@ extern {
1717// Do not remove inline: will result in relocation failure
1818// For the same reason we use inline ASM here instead of an extern static to
1919// locate the base
20+ /// Returns address at which current enclave is loaded.
2021#[ inline( always) ]
21- fn image_base ( ) -> u64 {
22+ #[ unstable( feature = "sgx_platform" , issue = "56975" ) ]
23+ pub fn image_base ( ) -> u64 {
2224 let base;
2325 unsafe { asm ! ( "lea IMAGE_BASE(%rip),$0" : "=r" ( base) ) } ;
2426 base
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use error::Error;
33use libc;
44use sys_common:: backtrace:: Frame ;
55use unwind as uw;
6+ use sys:: sgx:: abi:: mem:: image_base;
67
78pub struct BacktraceContext ;
89
@@ -75,11 +76,6 @@ extern "C" fn trace_fn(
7576 uw:: _URC_NO_REASON
7677}
7778
78- extern {
79- static IMAGE_BASE : u8 ;
80- }
81-
82-
8379// To reduce TCB size in Sgx enclave, we do not want to implement resolve_symname functionality.
8480// Rather, we print the offset of the address here, which could be later mapped to correct function.
8581pub fn resolve_symname < F > ( frame : Frame ,
@@ -88,7 +84,7 @@ pub fn resolve_symname<F>(frame: Frame,
8884 where F : FnOnce ( Option < & str > ) -> io:: Result < ( ) >
8985{
9086 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 _ ) ) ) ) )
9288}
9389
9490pub fn foreach_symbol_fileline < F > ( _: Frame ,
You can’t perform that action at this time.
0 commit comments