Skip to content

build fails on powerpc: error: 'ObjectCode' has no member named 'misalignment'

When building the Debian package for ghc-7.0.2 on powerpc, the build fails. Build log at https://buildd.debian.org/fetch.cgi?pkg=ghc;ver=7.0.2-1;arch=powerpc;stamp=1299367262 and relevant portion is:

rts/Linker.c:2440:0:
     error: 'ObjectCode' has no member named 'misalignment'

This is the code in question:

static void ocFlushInstructionCache( ObjectCode *oc )
{
    /* The main object code */
    ocFlushInstructionCacheFrom(oc->image + oc->misalignment, oc->fileSize);

    /* Jump Islands */
    ocFlushInstructionCacheFrom(oc->symbol_extras, sizeof(SymbolExtra) * oc->n_symbol_extras);
}

and it is inside

#ifdef powerpc_HOST_ARCH

The misalignment field is defined as

#ifndef USE_MMAP
#ifdef darwin_HOST_OS
                       , int misalignment
#endif
#endif

And USE_MMAP is true if

#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 ) && !defined(powerpc_HOST_ARCH) ) || \
    defined(kfreebsdgnu_HOST_OS) \
/* Don't use mmap on powerpc-apple-darwin as mmap doesn't support
 * reallocating but we need to allocate jump islands just after each
 * object images. Otherwise relative branches to jump islands can fail
 * due to 24-bits displacement overflow.
 */

(last entry added by Debian, but unrelated to this bug).

It seems that the correct line here should be

( !defined(darwin_HOST_OS ) && defined(powerpc_HOST_ARCH) ) || so that powerpc builds not on darwin use MMAP?

Also, I guess the failing line should be modified to also work in the absence of the misalignment flag.

I’d be grateful if you could tell me what exactly to patch here, as I’m not confident with the inner workings of the rts and even if I get it to compile, I would not be sure that it’s correct.

Thanks, Joachim

Trac metadata
Trac field Value
Version 7.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC 616635@bugs.debian.org
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information