X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FLinker.c;h=96b06c7b7d880ee51a671060723bdc42d716ce4d;hb=46e7ae64c37e193ae57fc8646602cc94a7caf573;hp=06240812c2bfcff59c353fdcba93950de088e6e7;hpb=5d52d9b64c21dcf77849866584744722f8121389;p=ghc-hetmet.git diff --git a/rts/Linker.c b/rts/Linker.c index 0624081..96b06c7 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -71,16 +71,14 @@ #include #endif -#if defined(ia64_HOST_ARCH) || defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) +#if defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(darwin_HOST_OS) #define USE_MMAP #include #include -#if defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) #ifdef HAVE_UNISTD_H #include #endif -#endif #endif @@ -136,7 +134,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 +1230,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 +1275,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 @@ -2953,10 +2954,18 @@ ocResolve_PEi386 ( ObjectCode* oc ) #define Elf_Sym Elf64_Sym #define Elf_Rel Elf64_Rel #define Elf_Rela Elf64_Rela +#ifndef ELF_ST_TYPE #define ELF_ST_TYPE ELF64_ST_TYPE +#endif +#ifndef ELF_ST_BIND #define ELF_ST_BIND ELF64_ST_BIND +#endif +#ifndef ELF_R_TYPE #define ELF_R_TYPE ELF64_R_TYPE +#endif +#ifndef ELF_R_SYM #define ELF_R_SYM ELF64_R_SYM +#endif #else #define ELFCLASS ELFCLASS32 #define Elf_Addr Elf32_Addr @@ -4203,6 +4212,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; @@ -4266,7 +4278,8 @@ static int relocateSection( else if(scat->r_type == PPC_RELOC_SECTDIFF || scat->r_type == PPC_RELOC_LO16_SECTDIFF || scat->r_type == PPC_RELOC_HI16_SECTDIFF - || scat->r_type == PPC_RELOC_HA16_SECTDIFF) + || scat->r_type == PPC_RELOC_HA16_SECTDIFF + || scat->r_type == PPC_RELOC_LOCAL_SECTDIFF) #else else if(scat->r_type == GENERIC_RELOC_SECTDIFF || scat->r_type == GENERIC_RELOC_LOCAL_SECTDIFF) @@ -4785,6 +4798,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 @@ -4810,6 +4824,7 @@ static int machoGetMisalignment( FILE * f ) return misalignment ? (16 - misalignment) : 0; } +#endif #endif