From 2bcf4bef2b3886e8023275d9378f546f6f9e5aa1 Mon Sep 17 00:00:00 2001 From: Jason Prado Date: Tue, 29 Mar 2016 20:18:03 -0700 Subject: [PATCH] FBReactKit: use indirect jumps to external functions Reviewed By: as106 Differential Revision: D3105839 fb-gh-sync-id: 24a8a215f65908b577891fb4b38366bad35cf6fc fbshipit-source-id: 24a8a215f65908b577891fb4b38366bad35cf6fc --- React/Profiler/RCTProfileTrampoline-arm.S | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/React/Profiler/RCTProfileTrampoline-arm.S b/React/Profiler/RCTProfileTrampoline-arm.S index 96f140b25..5725a5cb6 100644 --- a/React/Profiler/RCTProfileTrampoline-arm.S +++ b/React/Profiler/RCTProfileTrampoline-arm.S @@ -35,7 +35,10 @@ SYMBOL_NAME(RCTProfileTrampoline): * profile */ mov r0, #0xc - bl SYMBOL_NAME(malloc) + + ldr ip, LCPI_malloc + blx ip + /** * r4 is the callee saved register we'll use to refer to the allocated memory, * store its initial value, so we can restore it later @@ -87,10 +90,20 @@ SYMBOL_NAME(RCTProfileTrampoline): ldr r1, [r4, #0x8] ldr r4, [r4] push {r1} // save the caller on the stack - bl SYMBOL_NAME(free) + + ldr ip, LCPI_free + blx ip pop {lr} // pop the caller pop {r0} // pop the return value bx lr // jump to the calleer + trap + + .p2align 2 +LCPI_malloc: + .long SYMBOL_NAME(malloc) +LCPI_free: + .long SYMBOL_NAME(free) + #endif