[commit: ghc] master: Add NCG support for AIX/ppc32 (df26b95)
git at git.haskell.org
git at git.haskell.org
Thu Mar 24 22:25:50 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/df26b95559fd467abc0a3a4151127c95cb5011b9/ghc
>---------------------------------------------------------------
commit df26b95559fd467abc0a3a4151127c95cb5011b9
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Thu Mar 24 21:00:17 2016 +0100
Add NCG support for AIX/ppc32
This extends the previous work to revive the unregisterised GHC build
for AIX/ppc32. Strictly speaking, AIX runs on POWER4 (and later)
hardware, but the PPC32 instructions implemented in the PPC NCG
represent a compatible subset of the POWER4 ISA.
IBM AIX follows the PowerOpen ABI (and shares many similiarites with the
Linux PPC64 ELF V1 NCG backend) but uses the rather limited XCOFF
format (compared to ELF).
This doesn't support dynamic libraries yet.
A major limiting factor is that the AIX assembler does not support the
`@ha`/`@l` relocation types nor the ha16()/lo16() functions Darwin's
assembler supports. Therefore we need to avoid emitting those. In case
of numeric literals we simply compute the functions ourselves, while for
labels we have to use local TOCs and hope everything fits into a 16bit
offset (for ppc32 this gives us at most 16384 entries per TOC section,
which is enough to compile GHC).
Another issue is that XCOFF doesn't seem to have a relocation type for
label-differences, and therefore the label-differences placed into
tables-next-to-code can't be relocated, but the linker may rearrange
different sections, so we need to place all read-only sections into the
same `.text[PR]` section to workaround this.
Finally, the PowerOpen ABI distinguishes between function-descriptors
and actualy entry-point addresses. For AIX we need to be specific when
emitting assembler code whether we want the address of the function
descriptor `printf`) or for the entry-point (`.printf`). So we let the
asm pretty-printer prefix a dot to all emitted subroutine
calls (i.e. `BL`) on AIX only. For now, STG routines' entry-point labels
are not prefixed by a label and don't have any associated
function-descriptor.
Reviewers: austin, trommler, erikd, bgamari
Reviewed By: trommler, erikd, bgamari
Differential Revision: https://phabricator.haskell.org/D2019
>---------------------------------------------------------------
df26b95559fd467abc0a3a4151127c95cb5011b9
aclocal.m4 | 13 ++---
compiler/cmm/CLabel.hs | 13 +++--
compiler/ghc.mk | 14 -----
compiler/nativeGen/PIC.hs | 56 ++++++++++++++++++++
compiler/nativeGen/PPC/CodeGen.hs | 104 ++++++++++++++++++++++++++++++++++++--
compiler/nativeGen/PPC/Ppr.hs | 39 ++++++++++++--
compiler/nativeGen/PPC/Regs.hs | 2 +
compiler/nativeGen/PprBase.hs | 14 +++++
mk/config.mk.in | 5 +-
rts/StgCRun.c | 6 ++-
rts/StgCRunAsm.S | 81 ++++++++++++++++++++++++++---
rts/ghc.mk | 1 +
12 files changed, 302 insertions(+), 46 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc df26b95559fd467abc0a3a4151127c95cb5011b9
More information about the ghc-commits
mailing list