diff --git a/React/Profiler/RCTMacros.h b/React/Profiler/RCTMacros.h index 04635eb50..0df0ba62a 100644 --- a/React/Profiler/RCTMacros.h +++ b/React/Profiler/RCTMacros.h @@ -10,4 +10,9 @@ #define _CONCAT(A, B) A##B #define CONCAT(A, B) _CONCAT(A, B) -#define SYMBOL_NAME(S) CONCAT(__USER_LABEL_PREFIX__, S) +#if !defined(PIC_MODIFIER) +#define PIC_MODIFIER +#endif + +#define SYMBOL_NAME(name) CONCAT(__USER_LABEL_PREFIX__, name) +#define SYMBOL_NAME_PIC(name) CONCAT(SYMBOL_NAME(name), PIC_MODIFIER) diff --git a/React/Profiler/RCTProfileTrampoline-x86_64.S b/React/Profiler/RCTProfileTrampoline-x86_64.S index c473c362a..0325fb0f5 100644 --- a/React/Profiler/RCTProfileTrampoline-x86_64.S +++ b/React/Profiler/RCTProfileTrampoline-x86_64.S @@ -59,7 +59,7 @@ SYMBOL_NAME(RCTProfileTrampoline): * This is a C function defined in `RCTProfile.m`, the object and the selector * already have to be on %rdi and %rsi respectively, as in any ObjC call. */ - callq SYMBOL_NAME(RCTProfileGetImplementation) + callq SYMBOL_NAME_PIC(RCTProfileGetImplementation) // Restore/unalign the stack pointer, so we can access the registers we stored movq %r12, %rsp @@ -90,7 +90,7 @@ SYMBOL_NAME(RCTProfileTrampoline): // allocate 16 bytes movq $0x10, %rdi - callq SYMBOL_NAME(malloc) + callq SYMBOL_NAME_PIC(malloc) // store the initial value of calle saved registers %r13 and %r14 movq %r13, 0x0(%rax) @@ -108,7 +108,7 @@ SYMBOL_NAME(RCTProfileTrampoline): movq 0x38(%r12), %rsi // selector // void RCTProfileTrampolineStart(id, SEL) in RCTProfile.m - callq SYMBOL_NAME(RCTProfileTrampolineStart) + callq SYMBOL_NAME_PIC(RCTProfileTrampolineStart) // unalign the stack and restore %r12 movq %r12, %rsp @@ -148,7 +148,7 @@ SYMBOL_NAME(RCTProfileTrampoline): movdqa %xmm1, 0x10(%rsp) // void RCTProfileTrampolineEnd(void) in RCTProfile.m - just ends this profile - callq SYMBOL_NAME(RCTProfileTrampolineEnd) + callq SYMBOL_NAME_PIC(RCTProfileTrampolineEnd) /** * Restore the initial value of the callee saved registers, saved in the @@ -169,7 +169,7 @@ SYMBOL_NAME(RCTProfileTrampoline): andq $-0x10, %rsp // Free the memory allocated to stash callee saved registers - callq SYMBOL_NAME(free) + callq SYMBOL_NAME_PIC(free) // unalign stack and restore %r12 movq %r12, %rsp