Skip to content

Commit

Permalink
Use indirect jumps on armv7
Browse files Browse the repository at this point in the history
Summary:Immediate jumps on arm cannot jump further than 32mb, which might be a problem for large binaries.

+ add the missing `.thumb_func` directive.

Reviewed By: michalgr

Differential Revision: D3121148

fb-gh-sync-id: a53ad0ac70af9df84437b37f19b8a1cb49dd6fa2
fbshipit-source-id: a53ad0ac70af9df84437b37f19b8a1cb49dd6fa2
  • Loading branch information
tadeuzagallo authored and Facebook Github Bot 7 committed Apr 4, 2016
1 parent 0995861 commit 2f27039
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions React/Profiler/RCTProfileTrampoline-arm.S
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#if RCT_DEV && defined(__arm__)

.thumb
.align 5
.thumb_func
.globl SYMBOL_NAME(RCTProfileTrampoline)
SYMBOL_NAME(RCTProfileTrampoline):
/**
Expand All @@ -35,7 +35,9 @@ SYMBOL_NAME(RCTProfileTrampoline):
* profile
*/
mov r0, #0xc
bl SYMBOL_NAME(malloc)
ldr ip, =L_malloc
ldr ip, [ip]
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
Expand Down Expand Up @@ -87,10 +89,21 @@ SYMBOL_NAME(RCTProfileTrampoline):
ldr r1, [r4, #0x8]
ldr r4, [r4]
push {r1} // save the caller on the stack
bl SYMBOL_NAME(free)
ldr ip, =L_free
ldr ip, [ip]
blx ip

pop {lr} // pop the caller
pop {r0} // pop the return value
bx lr // jump to the calleer

trap

.data
.p2align 2
L_malloc:
.long SYMBOL_NAME(malloc)
L_free:
.long SYMBOL_NAME(free)

#endif

0 comments on commit 2f27039

Please sign in to comment.