Fix validate on OS X
[ghc-hetmet.git] / rts / Linker.c
index 07b2796..dbc8599 100644 (file)
@@ -136,7 +136,9 @@ static int ocVerifyImage_MachO    ( ObjectCode* oc );
 static int ocGetNames_MachO       ( ObjectCode* oc );
 static int ocResolve_MachO        ( ObjectCode* oc );
 
+#ifndef USE_MMAP
 static int machoGetMisalignment( FILE * );
+#endif
 #if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)
 static int ocAllocateSymbolExtras_MachO ( ObjectCode* oc );
 #endif
@@ -1230,11 +1232,12 @@ static OpenedDLL* opened_dlls = NULL;
 
 #  if defined(OBJFORMAT_ELF) || defined(OBJFORMAT_MACHO)
 
-static char *
+static const char *
 internal_dlopen(const char *dll_name)
 {
    void *hdl;
-   char *errmsg, *errmsg_copy;
+   const char *errmsg;
+   char *errmsg_copy;
 
    // omitted: RTLD_NOW
    // see http://www.haskell.org/pipermail/cvs-ghc/2007-September/038570.html
@@ -1274,7 +1277,7 @@ addDLL( char *dll_name )
 
 #define NMATCH 5
    regmatch_t match[NMATCH];
-   char *errmsg;
+   const char *errmsg;
    FILE* fp;
    size_t match_length;
 #define MAXLINE 1000
@@ -4211,6 +4214,9 @@ static int relocateSection(
                 thing += value;
                 break;
             case X86_64_RELOC_SIGNED:
+            case X86_64_RELOC_SIGNED_1:
+            case X86_64_RELOC_SIGNED_2:
+            case X86_64_RELOC_SIGNED_4:
                 ASSERT(reloc->r_pcrel);
                 thing += value - baseValue;
                 break;
@@ -4793,6 +4799,7 @@ static void machoInitSymbolsWithoutUnderscore()
 }
 #endif
 
+#ifndef USE_MMAP
 /*
  * Figure out by how much to shift the entire Mach-O file in memory
  * when loading so that its single segment ends up 16-byte-aligned
@@ -4818,6 +4825,7 @@ static int machoGetMisalignment( FILE * f )
 
     return misalignment ? (16 - misalignment) : 0;
 }
+#endif
 
 #endif