Avoid text relocations on arm trampoline

Summary:
fixes #7337

`ldr reg, =symbol` will cause a text relocation, which will fail to link if that's not allowed (which is the default for dynamic libraries).

Reviewed By: jspahrsummers

Differential Revision: D3281518

fbshipit-source-id: a057b4b9a54d568c8753a9dcd00365a86c7d93b0
This commit is contained in:
Tadeu Zagallo 2016-05-10 09:08:56 -07:00 committed by Facebook Github Bot 3
parent 4c3286f2a2
commit 65af925501
1 changed files with 8 additions and 2 deletions

View File

@ -35,7 +35,10 @@ SYMBOL_NAME(RCTProfileTrampoline):
* profile * profile
*/ */
mov r0, #0xc mov r0, #0xc
ldr ip, =L_malloc movw ip, :lower16:(L_malloc-(LPC1_0+4))
movt ip, :upper16:(L_malloc-(LPC1_0+4))
LPC1_0:
add ip, pc
ldr ip, [ip] ldr ip, [ip]
blx ip blx ip
/** /**
@ -89,7 +92,10 @@ SYMBOL_NAME(RCTProfileTrampoline):
ldr r1, [r4, #0x8] ldr r1, [r4, #0x8]
ldr r4, [r4] ldr r4, [r4]
push {r1} // save the caller on the stack push {r1} // save the caller on the stack
ldr ip, =L_free movw ip, :lower16:(L_free-(LPC1_1+4))
movt ip, :upper16:(L_free-(LPC1_1+4))
LPC1_1:
add ip, pc
ldr ip, [ip] ldr ip, [ip]
blx ip blx ip