Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#1150 closed bug (fixed)

Build Error on ia64

Reported by: sim Owned by:
Priority: normal Milestone:
Component: Build System Version: 6.6
Keywords: Cc:
Operating System: Linux Architecture: ia64
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


building ghc 6.6, I get this error:

../compiler/ghc-inplace -H16m -O -optc-O2 -optc-DNOSMP -static -I. 
-#include HCIncludes.h -fvia-C -dcmm-lint     -c Apply.cmm -o Apply.o

WARNING: Epilogue junk?:
        nop 0
        mov r8 = r14
        nop 0
        .endp stg_ap_0_fast#
        .align 16
        .global stg_PAP_entry#
        .proc stg_PAP_entry#

Prologue junk?:         .global stg_PAP_entry#
        .proc stg_PAP_entry#
        nop 0

make[1]: *** [Apply.o] Error 255
make: *** [stage1] Error 1

Attachments (1)

ghc-asm.lprl.patch (8.9 KB) - added by heatsink 12 years ago.
Patch to GHC 6.6 mangler, verified on ia64 with GCC 3.2

Download all attachments as: .zip

Change History (9)

comment:1 Changed 12 years ago by igloo

Milestone: _|_

The registerised IA64 port isn't actively supported at the moment, and it sounds like it has bitrotted.

comment:2 Changed 12 years ago by duncan

The last version I got to work in registerised mode on IA64 was 6.4.1 and then only when using reduced optimisation on a couple modules. With 6.4.2 I couldn't get it to build no matter how low I set the optimisations. The problem is in the mangler and in the fact that nothing stops ghc/gcc from using more than the fixed number of registers that is expected (which as I recall is 32 registers).

There are a couple emails on the ghc-users list about this stuff (but I'm too lazy at the moment to find them).

comment:3 Changed 12 years ago by heatsink

I got ghc 6.6 to build with gcc 3.2 and a hacked-together version of ghc 6.4.2 as the bootstrap compiler. The attached patch to the mangler gets rid of all prologue junk/epilogue junk warnings. The compiler does not produce working binaries, so don't trust what I've done yet.


  • The mangler no longer assumes the epilogue is the last code in the function. GCC 3.2 sometimes puts rarely-executed code after the epilogue. The mangler shouldn't be messing with non-epilogue code.
  • Removal of nop instructions, more bundling directives, proc, body, endp directives.
  • Removal of FP spill code. This isn't quite good because it will clobber floating-point registers in the caller, but it works for most purposes because FP registers aren't used much. (That was also done in my 6.4.2 build.)

Changed 12 years ago by heatsink

Attachment: ghc-asm.lprl.patch added

Patch to GHC 6.6 mangler, verified on ia64 with GCC 3.2

comment:4 Changed 12 years ago by heatsink

I put the compiler with the above patch through ghc's regression test suite. The overall result summary:

  • 3158 expected passes
  • 34 expected failures
  • 0 unexpected passes
  • 142 unexpected failures

69 of the unexpected failures were because a package or imported module was not present. 3 were because 'stdcall' isn't fully supported.

comment:5 Changed 12 years ago by igloo

Resolution: fixed
Status: newclosed

I've applied your patch to both the HEAD and 6.6 branch, thanks!

I'm a bit confused about the stdcall problems - isn't that calling convention only used on Windows?

I'm closing this bug, but if any of the test failures represent real bugs in the IA 64 port then of course feel free to open bugs (or better yet, send patches) for them (although preferably only if you can check whether they happen with the 6.6 branch or HEAD, rather than the 6.6 release).

comment:6 Changed 12 years ago by sim

Resolution: fixed
Status: closedreopened

with gcc 3.3.6 and ghc-6.7.20070227-src.tar.bz2 i get the error:

../compiler/ghc-inplace -H16m -O -optc-O2 -optc-DNOSMP -static -I. -#include HCIncludes.h -fvia-C -dcmm-lint     -c Apply.cmm -o Apply.o
/tmp/ghc11738_0/ghc11738_0.s: Assembler messages:

     Error: .endp outside of procedure
make[1]: *** [Apply.o] Error 1
make: *** [stage1] Error 1

Is there a chance to get the mangler work for gcc 3.3.6?

comment:7 Changed 12 years ago by igloo

Resolution: fixed
Status: reopenedclosed

Now fixed (both 6.6 branch and HEAD) for gcc 3.3.6 too, c/o Chris Rodrigues, by:

Sat Mar 17 02:55:29 GMT 2007
  * ia64 tailcall fix
  Tail-calls now branch to the end of the function after the call.  This 
  stops gcc from trying to move instructions into the space immediately 
  after the call, which confuses the mangler.
Sun Mar 18 03:31:32 GMT 2007
  * mangler and runtime updates for gcc 4 on ia64
  Gcc 4 is doing more clever optimizations than earlier gccs. 
  These changes let ghc compile and run on ia64 with gcc 4.0.3.
  Register stack frames are enlarged so that all functions use the 
  same size stack frame.
  The code to mangle tail calls has been cleaned up and made more 
  Additional floating-point and special-purpose registers used by 
  GCC are saved upon entering the STG runtime.
  More general handling of NOP instructions.
  Handling of functions with multiple epilogues or no epilogue.

comment:8 Changed 11 years ago by herry

Huren Kontakte

69 of the unexpected failures were because a package or imported module was not present. 3 were because 'stdcall' isn't fully supported. Problems resolved.
Note: See TracTickets for help on using tickets.