Ticket #7707: ios-patch-6a-compatibility-with-ios-assembler.patch

File ios-patch-6a-compatibility-with-ios-assembler.patch, 1.9 KB (added by StephenBlackheath, 3 years ago)

iOS patch 6 rev a: minor arm-iOS specific assembler changes

  • rts/StgCRun.c

    diff --git a/rts/StgCRun.c b/rts/StgCRun.c
    index 5789c82..87414d4 100644
    a b StgRunIsImplementedInAssembler(void) 
    658658#define THUMB_FUNC
    659659#endif
    660660
     661#if defined(ios_HOST_OS)
     662#define STG_GLOBAL ".globl "
     663#else
     664#define STG_GLOBAL ".global "
     665#endif
     666
    661667StgRegTable *
    662668StgRun(StgFunPtr f, StgRegTable *basereg) {
    663669    StgRegTable * r;
    StgRun(StgFunPtr f, StgRegTable *basereg) { 
    665671        /*
    666672         * save callee-saves registers on behalf of the STG code.
    667673         */
     674#if defined(ios_HOST_OS)
     675        "stmfd sp!, {r4-r10, r11, ip, lr}\n\t"
     676#else
    668677        "stmfd sp!, {r4-r10, fp, ip, lr}\n\t"
     678#endif
    669679#if !defined(arm_HOST_ARCH_PRE_ARMv6)
    670680        "vstmdb sp!, {d8-d11}\n\t"
    671681#endif
    StgRun(StgFunPtr f, StgRegTable *basereg) { 
    684694         */
    685695        "bx %1\n\t"
    686696
    687         ".global " STG_RETURN "\n\t"
     697        STG_GLOBAL STG_RETURN "\n\t"
    688698        THUMB_FUNC
     699#if !defined(ios_HOST_OS)
    689700        ".type " STG_RETURN ", %%function\n"
     701#endif
    690702        STG_RETURN ":\n\t"
    691703        /*
    692704         * Free the space we allocated
    StgRun(StgFunPtr f, StgRegTable *basereg) { 
    702714#if !defined(arm_HOST_ARCH_PRE_ARMv6)
    703715        "vldmia sp!, {d8-d11}\n\t"
    704716#endif
     717#if defined(ios_HOST_OS)
     718        "ldmfd sp!, {r4-r10, r11, ip, lr}\n\t"
     719#else
    705720        "ldmfd sp!, {r4-r10, fp, ip, lr}\n\t"
     721#endif
    706722      : "=r" (r)
    707723      : "r" (f), "r" (basereg), "i" (RESERVED_C_STACK_BYTES)
    708724#if !defined(__thumb__)
    StgRun(StgFunPtr f, StgRegTable *basereg) { 
    718734           includes/stg/MachRegs.h Please note that Haskell code is
    719735           compiled by GHC/LLVM into ARM code (not Thumb!), at least
    720736           as of February 2012 */
     737#if defined(ios_HOST_OS)
     738      : "%r4", "%r5", "%r6", "%r8", "%r9", "%r10", "%r11", "%ip", "%lr"
     739#else
    721740      : "%r4", "%r5", "%r6", "%r8", "%r9", "%r10", "%fp", "%ip", "%lr"
    722741#endif
     742#endif
    723743    );
    724744    return r;
    725745}