[llvm-commits] [compiler-rt] r161577 - /compiler-rt/trunk/lib/interception/mach_override/mach_override.c
Alexander Potapenko
glider at google.com
Thu Aug 9 06:33:02 PDT 2012
Author: glider
Date: Thu Aug 9 08:33:02 2012
New Revision: 161577
URL: http://llvm.org/viewvc/llvm-project?rev=161577&view=rev
Log:
Make the non-interface mach_override functions static to avoid name clashes with user code that may contain its own mach_override.
Modified:
compiler-rt/trunk/lib/interception/mach_override/mach_override.c
Modified: compiler-rt/trunk/lib/interception/mach_override/mach_override.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/mach_override/mach_override.c?rev=161577&r1=161576&r2=161577&view=diff
==============================================================================
--- compiler-rt/trunk/lib/interception/mach_override/mach_override.c (original)
+++ compiler-rt/trunk/lib/interception/mach_override/mach_override.c Thu Aug 9 08:33:02 2012
@@ -29,6 +29,7 @@
#if defined(__ppc__) || defined(__POWERPC__)
+static
long kIslandTemplate[] = {
0x9001FFFC, // stw r0,-4(SP)
0x3C00DEAD, // lis r0,0xDEAD
@@ -48,6 +49,7 @@
#define kOriginalInstructionsSize 16
+static
char kIslandTemplate[] = {
// kOriginalInstructionsSize nop instructions so that we
// should have enough space to host original instructions
@@ -65,6 +67,7 @@
#define kJumpAddress kOriginalInstructionsSize + 6
+static
char kIslandTemplate[] = {
// kOriginalInstructionsSize nop instructions so that we
// should have enough space to host original instructions
@@ -104,26 +107,27 @@
#pragma mark -
#pragma mark (Funky Protos)
- mach_error_t
+
+ static mach_error_t
allocateBranchIsland(
BranchIsland **island,
int allocateHigh,
void *originalFunctionAddress) __attribute__((visibility("hidden")));
- mach_error_t
+ static mach_error_t
freeBranchIsland(
BranchIsland *island ) __attribute__((visibility("hidden")));
- mach_error_t
+ static mach_error_t
defaultIslandMalloc(
void **ptr, size_t unused_size, void *hint) __attribute__((visibility("hidden")));
- mach_error_t
+ static mach_error_t
defaultIslandFree(
void *ptr) __attribute__((visibility("hidden")));
#if defined(__ppc__) || defined(__POWERPC__)
- mach_error_t
+ static mach_error_t
setBranchIslandTarget(
BranchIsland *island,
const void *branchTo,
@@ -131,11 +135,13 @@
#endif
#if defined(__i386__) || defined(__x86_64__)
-mach_error_t
+static mach_error_t
setBranchIslandTarget_i386(
BranchIsland *island,
const void *branchTo,
char* instructions ) __attribute__((visibility("hidden")));
+// Can't be made static because there's no C implementation for atomic_mov64
+// on i386.
void
atomic_mov64(
uint64_t *targetAddress,
@@ -174,7 +180,7 @@
#pragma mark (Interface)
#if defined(__i386__) || defined(__x86_64__)
-mach_error_t makeIslandExecutable(void *address) {
+static mach_error_t makeIslandExecutable(void *address) {
mach_error_t err = err_none;
vm_size_t pageSize;
host_page_size( mach_host_self(), &pageSize );
@@ -189,12 +195,12 @@
}
#endif
- mach_error_t
+ static mach_error_t
defaultIslandMalloc(
void **ptr, size_t unused_size, void *hint) {
return allocateBranchIsland( (BranchIsland**)ptr, kAllocateHigh, hint );
}
- mach_error_t
+ static mach_error_t
defaultIslandFree(
void *ptr) {
return freeBranchIsland(ptr);
@@ -460,7 +466,7 @@
***************************************************************************/
- mach_error_t
+ static mach_error_t
allocateBranchIsland(
BranchIsland **island,
int allocateHigh,
@@ -530,7 +536,7 @@
***************************************************************************/
- mach_error_t
+ static mach_error_t
freeBranchIsland(
BranchIsland *island )
{
@@ -568,7 +574,7 @@
***************************************************************************/
#if defined(__ppc__) || defined(__POWERPC__)
- mach_error_t
+ static mach_error_t
setBranchIslandTarget(
BranchIsland *island,
const void *branchTo,
@@ -598,7 +604,7 @@
#endif
#if defined(__i386__)
- mach_error_t
+ static mach_error_t
setBranchIslandTarget_i386(
BranchIsland *island,
const void *branchTo,
@@ -622,7 +628,7 @@
}
#elif defined(__x86_64__)
-mach_error_t
+static mach_error_t
setBranchIslandTarget_i386(
BranchIsland *island,
const void *branchTo,
More information about the llvm-commits
mailing list