From 59177a1b536b8a40924d8efa5520fb664447f92a Mon Sep 17 00:00:00 2001 From: wolfgang Date: Mon, 13 Jun 2005 00:15:58 +0000 Subject: [PATCH] [project @ 2005-06-13 00:15:58 by wolfgang] Darwin/x86: Fix two causes for crashes: *) align literals to 16 bytes, because Apple's GCC likes to use SSE instructions which require this alignment. *) In print_doctored, recognize global jumps that masquerade as local jumps by going via Lfoo$stub or Lfoo$non_lazy_ptr. --- ghc/driver/mangler/ghc-asm.lprl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ghc/driver/mangler/ghc-asm.lprl b/ghc/driver/mangler/ghc-asm.lprl index ec12d79..b95cad8 100644 --- a/ghc/driver/mangler/ghc-asm.lprl +++ b/ghc/driver/mangler/ghc-asm.lprl @@ -332,7 +332,7 @@ sub init_TARGET_STUFF { $T_DOT_WORD = '\.(long|short|byte|fill|space)'; $T_DOT_GLOBAL = '\.globl'; $T_HDR_toc = "\.toc\n"; - $T_HDR_literal = "\t\.const\n\t\.align 2\n"; + $T_HDR_literal = "\t\.const\n\t\.align 4\n"; # align for SSE $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"; @@ -1532,6 +1532,16 @@ sub print_doctored { # fix _all_ non-local jumps: + if ( $TargetPlatform =~ /^.*-apple-darwin.*/ ) { + # On Darwin, we've got local-looking jumps that are + # actually global (i.e. jumps to Lfoo$stub or via + # Lfoo$non_lazy_ptr), so we fix those first. + # In fact, we just fix everything that contains a dollar + # because false positives don't hurt here. + + s/^(\tjmp\s+\*?L.*\$.*\n)/$exit_patch$1/g; + } + s/^\tjmp\s+\*${T_X86_PRE_LLBL_PAT}/\tJMP___SL/go; s/^\tjmp\s+${T_X86_PRE_LLBL_PAT}/\tJMP___L/go; -- 1.7.10.4