Ticket #4999: powerpc-compile-fix.diff

File powerpc-compile-fix.diff, 4.7 KB (added by erikd, 2 years ago)

Patch against 7.0.2 to fix this.

  • rts/Linker.c

    diff -rN -u old-ghc-upstream/rts/Linker.c new-ghc-upstream/rts/Linker.c
    old new  
    7070#include <sys/wait.h> 
    7171#endif 
    7272 
    73 #if defined(linux_HOST_OS    ) || defined(freebsd_HOST_OS) || \ 
    74     defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \ 
    75     defined(openbsd_HOST_OS ) || \ 
    76     ( defined(darwin_HOST_OS ) && !defined(powerpc_HOST_ARCH) ) || \ 
    77     defined(kfreebsdgnu_HOST_OS) 
    78 /* Don't use mmap on powerpc-apple-darwin as mmap doesn't support 
     73#if !defined(powerpc_HOST_ARCH) && \ 
     74    (   defined(linux_HOST_OS    ) || defined(freebsd_HOST_OS) || \ 
     75        defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \ 
     76        defined(openbsd_HOST_OS  ) || defined(darwin_HOST_OS ) || \ 
     77        defined(kfreebsdgnu_HOST_OS) ) 
     78/* Don't use mmap on powerpc_HOST_ARCH as mmap doesn't support 
    7979 * reallocating but we need to allocate jump islands just after each 
    8080 * object images. Otherwise relative branches to jump islands can fail 
    8181 * due to 24-bits displacement overflow. 
     
    132132static ObjectCode* mkOc( char *path, char *image, int imageSize, 
    133133                         char *archiveMemberName 
    134134#ifndef USE_MMAP 
    135 #ifdef darwin_HOST_OS 
     135#ifdef powerpc_HOST_ARCH 
    136136                       , int misalignment 
    137137#endif 
    138138#endif 
     
    156156static int ocGetNames_MachO       ( ObjectCode* oc ); 
    157157static int ocResolve_MachO        ( ObjectCode* oc ); 
    158158 
    159 #ifndef USE_MMAP 
     159#if !defined USE_MMAP && defined(darwin_HOST_OS) 
    160160static int machoGetMisalignment( FILE * ); 
    161161#endif 
    162162#if defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) 
     
    981981      SymI_HasProto(stg_yieldzh)                        \ 
    982982      SymI_NeedsProto(stg_interp_constr_entry)          \ 
    983983      SymI_HasProto(stg_arg_bitmaps)                    \ 
    984       SymI_HasProto(large_alloc_lim)                    \ 
     984      SymI_HasProto(alloc_blocks_lim)                   \ 
    985985      SymI_HasProto(g0)                                 \ 
    986986      SymI_HasProto(allocate)                           \ 
    987987      SymI_HasProto(allocateExec)                       \ 
     
    15911591       } else { 
    15921592           if ((W_)result > 0x80000000) { 
    15931593               // oops, we were given memory over 2Gb 
    1594 #if defined(freebsd_HOST_OS)  || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) 
     1594#if defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) 
    15951595               // Some platforms require MAP_FIXED.  This is normally 
    15961596               // a bad idea, because MAP_FIXED will overwrite 
    15971597               // existing mappings. 
     
    16301630mkOc( char *path, char *image, int imageSize, 
    16311631      char *archiveMemberName 
    16321632#ifndef USE_MMAP 
    1633 #ifdef darwin_HOST_OS 
     1633#ifdef powerpc_HOST_ARCH 
    16341634    , int misalignment 
    16351635#endif 
    16361636#endif 
     
    16691669   oc->proddables        = NULL; 
    16701670 
    16711671#ifndef USE_MMAP 
    1672 #ifdef darwin_HOST_OS 
     1672#ifdef powerpc_HOST_ARCH 
    16731673   oc->misalignment = misalignment; 
    16741674#endif 
    16751675#endif 
     
    16961696    char tmp[12]; 
    16971697    char *gnuFileIndex; 
    16981698    int gnuFileIndexSize; 
    1699 #if !defined(USE_MMAP) && defined(darwin_HOST_OS) 
     1699#if !defined(USE_MMAP) && defined(powerpc_HOST_ARCH) 
    17001700    int misalignment; 
    17011701#endif 
    17021702 
     
    18901890 
    18911891            oc = mkOc(path, image, memberSize, archiveMemberName 
    18921892#ifndef USE_MMAP 
    1893 #ifdef darwin_HOST_OS 
     1893#ifdef powerpc_HOST_ARCH 
    18941894                     , misalignment 
    18951895#endif 
    18961896#endif 
     
    19711971   int fd; 
    19721972#else 
    19731973   FILE *f; 
    1974 #  if defined(darwin_HOST_OS) 
     1974#  if defined(powerpc_HOST_ARCH) 
    19751975   int misalignment; 
    19761976#  endif 
    19771977#endif 
     
    20652065 
    20662066   oc = mkOc(path, image, fileSize, NULL 
    20672067#ifndef USE_MMAP 
    2068 #ifdef darwin_HOST_OS 
     2068#ifdef powerpc_HOST_ARCH 
    20692069            , misalignment 
    20702070#endif 
    20712071#endif 
     
    23152315  int aligned; 
    23162316#ifndef USE_MMAP 
    23172317  int misalignment = 0; 
    2318 #ifdef darwin_HOST_OS 
     2318#ifdef powerpc_HOST_ARCH 
    23192319  misalignment = oc->misalignment; 
    23202320#endif 
    23212321#endif 
     
    53445344} 
    53455345#endif 
    53465346 
    5347 #ifndef USE_MMAP 
     5347#if !defined USE_MMAP && defined(darwin_HOST_OS) 
    53485348/* 
    53495349 * Figure out by how much to shift the entire Mach-O file in memory 
    53505350 * when loading so that its single segment ends up 16-byte-aligned 
  • rts/LinkerInternals.h

    diff -rN -u old-ghc-upstream/rts/LinkerInternals.h new-ghc-upstream/rts/LinkerInternals.h
    old new  
    8080    /* ptr to malloc'd lump of memory holding the obj file */ 
    8181    char*      image; 
    8282 
    83 #ifdef darwin_HOST_OS 
     83#ifdef powerpc_HOST_ARCH 
    8484    /* record by how much image has been deliberately misaligned 
    8585       after allocation, so that we can use realloc */ 
    8686    int        misalignment;