Hi Simon,

The effort all feels a little bit worthless now that you've released GHC
5.00, but here is how to get GHC 4.08.2 to work with GCC 2.95.2 on HP-UX.
I've attached the modified files from the 4.08.2 distribution. So, here's
how to build yourself a working 4.08.2 from the currently available 4.08.1
binary:

    1. Install GHC 4.08.1 and GCC 2.95.2 as per their respective
instructions.
       GCC must be using the GNU assembler. If you've downloaded any of the
       pre-built distributions this will be the case.

       Note: If you don't have a currently working happy you can build this
       with GHC 4.08.1 and GCC 2.95.2 providing you "export
LDOPTS=-aarchive"
       first. Make sure you "unset LDOPTS" before going on to build GHC
however.

    2. Get the GHC 4.08.2 source and unpack it someplace.

    3. Untar the attached file over the top of this. (Changes described
later)

    4. "configure" GHC and do the "make boot" step, but do not do the "make
all"
       part yet.

    5. Copy ghc-4.08.2/ghc/driver/ghc-asm.prl into your current 4.08.1
binary
       install location instead of the current file at
       <prefix for 4.08.1>/lib/ghc-4.08.1/ghc-asm.prl. This makes your
4.08.1
       distribution mangle correctly for GCC 2.95.2.

    6. Now do the "make all" step.

    7. The "make all" will fail at the hsc link line with an unsatified
symbol
       error for "word64ToIntegerzh_fast". It also prints a message about P'
       being required for code symbols. Don't be alarmed the next step will
       remedy this.

    8. Copy ghc-4.08.2/ghc/rts/libHSrts.a into the current 4.08.1 binary
location
       in a similar way to ghc-asm.prl. The location for this is <prefix for
       4.08.1>/lib/ghc-4.08.1/libHSrts.a.

    9. "make all" again... It will skip all the steps it completed last time
       and proceed with building hsc successfully before continuing to
       completion.

   10. Install at will, you are done.

What I have changed is this:

    ghc-4.08.2/ghc/includes/TailCalls.h
          The 4.08.2 version has a __DISCARD__ function mentioned in the FB_
macro.
        I've removed this for HPPA.

    ghc-4.08.2/ghc/includes/ghc-asm.lprl
          I've modified the mangler macros, firstly to understand the
NSUBSPA
        GNU as directive. All functions are now started with an NSUBSPA
        directive to put them in a new subspace. The only exception are the
        _entry/_ret ones that drop no subspace directives under the
assumption
        that the section will always immediately follow an _info section.

        All literal data is now in the DATA (dynamic area) rather than TEXT
        (static area). GCC did originally differentiate between literals
        (strings, etc.) and function pointer indirections, but only via
        subspaces, not with label name. I've opted to make it all DATA,
which
        will lead to a marginally increased swap use, and inability to share
        literal data between multiple instances of the same executable.

        The literal output section has been modified to search for lines of
the
        form: ".word P%<symbol name>" and remove the P% from these. Thus
        removing the procedure labels.

    ghc-4.08.2/ghc/rts/RtsStartup.c
    ghc-4.08.2/ghc/rts/Main.c
    ghc-4.08.2/ghc/rts/MangledFunctPtrs.hc
    ghc-4.08.2/ghc/rts/MangledFunctPtrs.c
        The entry points __init_Prelude, stg_init_ret and __init_PrelMain
must
        be accessible to the top two functions in their non-procedure label
        form. The best I could come up with in this instance was to have a
        mangled array in a separate file and use that for the lookup on HP.
        This is in the new file MangledFunctPtrs.hc. I hope these will not
        impact other platforms.

Let me know what you think. I know it doesn't address GHC 5.00 (one step at
a time), but it gets a running GHC 4.08.2 that should be able to build
itself without any of the messing about as in the transition from 4.08.1 to
4.08.2. Hopefully, a similar set of changes to 5.00 will get that working in
the same way.

Regards,
Andy.

P.S. To save on internet traffic I've not mailed the changes to the mailing
list. If anyone is interested, reply and I'll forward a copy.

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to