summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorwolfgang.thaller@gmx.net <unknown>2006-11-27 13:06:02 +0000
committerwolfgang.thaller@gmx.net <unknown>2006-11-27 13:06:02 +0000
commitffdbb302967a147550113251e47b9d98a7affdc0 (patch)
tree9d3f3e67c928c92b1ef23ba30b1524e131007239 /driver
parent08560cf0e3a2a1928650ca5d5d0bb44fbac2ea44 (diff)
downloadhaskell-ffdbb302967a147550113251e47b9d98a7affdc0.tar.gz
Initial support for x86_64-darwin
Basic -fvia-C code generation is there, not much testing.
Diffstat (limited to 'driver')
-rw-r--r--driver/mangler/ghc-asm.lprl40
1 files changed, 40 insertions, 0 deletions
diff --git a/driver/mangler/ghc-asm.lprl b/driver/mangler/ghc-asm.lprl
index ab43cdcd7d..90b49751b6 100644
--- a/driver/mangler/ghc-asm.lprl
+++ b/driver/mangler/ghc-asm.lprl
@@ -344,6 +344,32 @@ sub init_TARGET_STUFF {
$T_HDR_vector = "\t\.text\n\t\.align 2\n";
#--------------------------------------------------------#
+ } elsif ( $TargetPlatform =~ /^x86_64-apple-darwin.*/ ) {
+ # Apple PowerPC Darwin/MacOS X.
+ $T_STABBY = 0; # 1 iff .stab things (usually if a.out format)
+ $T_US = '_'; # _ if symbols have an underscore on the front
+ $T_PRE_APP = 'DOESNT APPLY'; # regexp that says what comes before APP/NO_APP
+ $T_CONST_LBL = '^\LC\d+:'; # regexp for what such a lbl looks like
+ $T_POST_LBL = ':';
+
+ $T_MOVE_DIRVS = '^(\s*(\.align \d+|\.text|\.data|\.const_data|\.cstring|\.non_lazy_symbol_pointer|\.const|\.static_const|\.literal4|\.literal8|\.static_data|\.globl \S+|\.section .*|\.lcomm.*)\n)';
+ $T_COPY_DIRVS = '\.(globl|lcomm)';
+
+ $T_DOT_WORD = '\.(quad|long|short|byte|fill|space)';
+ $T_DOT_GLOBAL = '\.globl';
+ $T_HDR_toc = "\.toc\n";
+ $T_HDR_literal16= "\t\.literal8\n\t\.align 4\n";
+ $T_HDR_literal = "\t\.const\n\t\.align 4\n";
+ $T_HDR_misc = "\t\.text\n\t\.align 2\n";
+ $T_HDR_data = "\t\.data\n\t\.align 2\n";
+ $T_HDR_rodata = "\t\.const\n\t\.align 2\n";
+ $T_HDR_relrodata= "\t\.const_data\n\t\.align 2\n";
+ $T_HDR_closure = "\t\.data\n\t\.align 2\n";
+ $T_HDR_info = "\t\.text\n\t\.align 2\n";
+ $T_HDR_entry = "\t\.text\n\t\.align 2\n";
+ $T_HDR_vector = "\t\.text\n\t\.align 2\n";
+
+ #--------------------------------------------------------#
} elsif ( $TargetPlatform =~ /^powerpc-.*-linux/ ) {
# PowerPC Linux
$T_STABBY = 0; # 1 iff .stab things (usually if a.out format)
@@ -1730,6 +1756,20 @@ sub rev_tbl {
}
}
+ if ( $TargetPlatform =~ /x86_64-apple-darwin/ ) {
+ # Tack a label to the front of the info table, too.
+ # For now, this just serves to work around a crash in Apple's new
+ # 64-bit linker (it seems to assume that there is no data before the
+ # first label in a section).
+
+ # The plan for the future is to do this on all Darwin platforms, and
+ # to add a reference to this label after the entry code, just as the
+ # NCG does, so we can enable dead-code-stripping in the linker without
+ # losing our info tables. (Hence the name _dsp, for dead-strip preventer)
+
+ $before .= "\n${infoname}_dsp:\n";
+ }
+
$tbl = $before
. (($TargetPlatform !~ /^hppa/) ? '' : join("\n", @imports) . "\n")
. join("\n", @words) . "\n"