diff options
-rw-r--r-- | compiler-rt/lib/asan/asan_interceptors.h | 12 | ||||
-rw-r--r-- | compiler-rt/lib/asan/mach_override/README.txt | 2 | ||||
-rw-r--r-- | compiler-rt/lib/asan/mach_override/mach_override.c | 16 | ||||
-rw-r--r-- | compiler-rt/lib/asan/mach_override/mach_override.h | 4 |
4 files changed, 19 insertions, 15 deletions
diff --git a/compiler-rt/lib/asan/asan_interceptors.h b/compiler-rt/lib/asan/asan_interceptors.h index 39b66fec72a..20a2688f561 100644 --- a/compiler-rt/lib/asan/asan_interceptors.h +++ b/compiler-rt/lib/asan/asan_interceptors.h @@ -39,15 +39,15 @@ #define WRAPPER_NAME(x) "wrap_"#x #define OVERRIDE_FUNCTION(oldfunc, newfunc) \ - CHECK(0 == mach_override_ptr((void*)(oldfunc), \ - (void*)(newfunc), \ - (void**)&real_##oldfunc)); \ + CHECK(0 == __asan_mach_override_ptr((void*)(oldfunc), \ + (void*)(newfunc), \ + (void**)&real_##oldfunc)); \ CHECK(real_##oldfunc != NULL); #define OVERRIDE_FUNCTION_IF_EXISTS(oldfunc, newfunc) \ - do { mach_override_ptr((void*)(oldfunc), \ - (void*)(newfunc), \ - (void**)&real_##oldfunc); } while (0) + do { __asan_mach_override_ptr((void*)(oldfunc), \ + (void*)(newfunc), \ + (void**)&real_##oldfunc); } while (0) #define INTERCEPT_FUNCTION(func) \ OVERRIDE_FUNCTION(func, WRAP(func)) diff --git a/compiler-rt/lib/asan/mach_override/README.txt b/compiler-rt/lib/asan/mach_override/README.txt index 2fb605a375e..5f62ad7b994 100644 --- a/compiler-rt/lib/asan/mach_override/README.txt +++ b/compiler-rt/lib/asan/mach_override/README.txt @@ -4,4 +4,6 @@ -- The files are guarded with #ifdef __APPLE__ -- some opcodes are added in order to parse the library functions on Lion -- fixupInstructions() is extended to relocate relative calls, not only jumps +-- mach_override_ptr is renamed to __asan_mach_override_ptr and + other functions are marked as hidden. diff --git a/compiler-rt/lib/asan/mach_override/mach_override.c b/compiler-rt/lib/asan/mach_override/mach_override.c index 25ee9d29bb8..7c259000891 100644 --- a/compiler-rt/lib/asan/mach_override/mach_override.c +++ b/compiler-rt/lib/asan/mach_override/mach_override.c @@ -108,18 +108,18 @@ typedef struct { allocateBranchIsland( BranchIsland **island, int allocateHigh, - void *originalFunctionAddress); + void *originalFunctionAddress) __attribute__((visibility("hidden"))); mach_error_t freeBranchIsland( - BranchIsland *island ); + BranchIsland *island ) __attribute__((visibility("hidden"))); #if defined(__ppc__) || defined(__POWERPC__) mach_error_t setBranchIslandTarget( BranchIsland *island, const void *branchTo, - long instruction ); + long instruction ) __attribute__((visibility("hidden"))); #endif #if defined(__i386__) || defined(__x86_64__) @@ -127,11 +127,11 @@ mach_error_t setBranchIslandTarget_i386( BranchIsland *island, const void *branchTo, - char* instructions ); + char* instructions ) __attribute__((visibility("hidden"))); void atomic_mov64( uint64_t *targetAddress, - uint64_t value ); + uint64_t value ) __attribute__((visibility("hidden"))); static Boolean eatKnownInstructions( @@ -140,7 +140,7 @@ eatKnownInstructions( int *howManyEaten, char *originalInstructions, int *originalInstructionCount, - uint8_t *originalInstructionSizes ); + uint8_t *originalInstructionSizes ) __attribute__((visibility("hidden"))); static void fixupInstructions( @@ -148,7 +148,7 @@ fixupInstructions( void *escapeIsland, void *instructionsToFix, int instructionCount, - uint8_t *instructionSizes ); + uint8_t *instructionSizes ) __attribute__((visibility("hidden"))); #endif /******************************************************************************* @@ -176,7 +176,7 @@ mach_error_t makeIslandExecutable(void *address) { #endif mach_error_t -mach_override_ptr( +__asan_mach_override_ptr( void *originalFunctionAddress, const void *overrideFunctionAddress, void **originalFunctionReentryIsland ) diff --git a/compiler-rt/lib/asan/mach_override/mach_override.h b/compiler-rt/lib/asan/mach_override/mach_override.h index f1aa617418e..dcccbcd8732 100644 --- a/compiler-rt/lib/asan/mach_override/mach_override.h +++ b/compiler-rt/lib/asan/mach_override/mach_override.h @@ -77,8 +77,10 @@ ************************************************************************************/ +// We're prefixing mach_override_ptr() with "__asan_" to avoid name conflicts with other +// mach_override_ptr() implementations that may appear in the client program. mach_error_t -mach_override_ptr( +__asan_mach_override_ptr( void *originalFunctionAddress, const void *overrideFunctionAddress, void **originalFunctionReentryIsland ); |