#include <stdio.h>
__attribute__((weak))
void* p = 0;
const uintptr_t offset = 1ULL << 36;
void* pMinus = (void*)((uintptr_t)&p - offset);
extern int objc_msgSend;
void* msgSendMinus = (void*)((uintptr_t)&objc_msgSend - offset);
int main()
{
printf("[BEGIN] bind-addend\n");
if ( pMinus != (void*)((uintptr_t)&p - offset) ) {
printf("[FAIL] bind-addend: %p != %p\n", pMinus, (void*)((uintptr_t)&p - offset));
return 0;
}
if ( msgSendMinus != (void*)((uintptr_t)&objc_msgSend - offset) ) {
printf("[FAIL] bind-addend: %p != %p\n", msgSendMinus, (void*)((uintptr_t)&objc_msgSend - offset));
return 0;
}
printf("[PASS] bind-addend\n");
return 0;
}