Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Code to get absolute address from relative call in Objective-C. (ssVal is the address of the E8 byte, baseptr is the base address but you don't even need it since its not used)
uintptr_t PrepareBase(uintptr_t ssVal, uintptr_t baseptr) {
uint8_t *ssv = (uint8_t *)(ssVal +1);
uint8_t *ssvxx = (uint8_t *)(ssVal);
uint8_t *ssvx = (uint8_t *)(ssVal -1);
char ssvValue = (char)ssVal;
char ssvValue2 = (char)ssv;
char ssvValue3 = (char)ssvx;
uint32_t ssv2 = (uint32_t)(*ssv);
uintptr_t uhh = ssVal;
uintptr_t uxx = ssVal - baseptr;
int32_t *uhh5 = (int32_t *)(uhh+1);
int32_t uhh5x = (int32_t)*uhh5;
// Begin tons of number stuff!
int sign = isSigned(uhh5x);
uint32_t val = abs(uhh5x);
uintptr_t xptr;
if (sign == 1) {
xptr = (uintptr_t)(ssvxx + val);
} else if (sign == -1) {
xptr = (uintptr_t)(ssvxx - val);
return xptr;
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.