diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2016-03-08 08:14:08 +0000 |
---|---|---|
committer | Sergei Trofimovich <siarheit@google.com> | 2016-03-08 08:14:27 +0000 |
commit | 90e1e160b783644c2d3cc0a05e3a804cea549cf9 (patch) | |
tree | c150978c9ee9efbe0b3e19da9e21d1a7c10e7154 /compiler/cmm/PprC.hs | |
parent | 82e36edcbd831e9b7c05e1c2cb918ad5de56cd3a (diff) | |
download | haskell-90e1e160b783644c2d3cc0a05e3a804cea549cf9.tar.gz |
Split external symbol prototypes (EF_) (Trac #11395)
Before the patch both Cmm and C symbols were declared
with 'EF_' macro:
#define EF_(f) extern StgFunPtr f()
but for Cmm symbols we know exact prototypes.
The patch splits there prototypes in to:
#define EFF_(f) void f() /* See Note [External function prototypes] */
#define EF_(f) StgFunPtr f(void)
Cmm functions are 'EF_' (External Functions),
C functions are 'EFF_' (External Foreign Functions).
While at it changed external C function prototype
to return 'void' to workaround ghc bug on m68k.
Described in detail in Trac #11395.
This makes simple tests work on m68k-linux target!
Thanks to Michael Karcher for awesome analysis
happening in Trac #11395.
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Test Plan: ran "hello world" on m68k successfully
Reviewers: simonmar, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1975
GHC Trac Issues: #11395
Diffstat (limited to 'compiler/cmm/PprC.hs')
-rw-r--r-- | compiler/cmm/PprC.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index c269530409..673ac2d5bd 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -264,7 +264,7 @@ pprStmt stmt = -- We also need to cast mem primops to prevent conflicts with GCC -- builtins (see bug #5967). | Just _align <- machOpMemcpyishAlign op - = (text ";EF_(" <> fn <> char ')' <> semi) $$ + = (text ";EFF_(" <> fn <> char ')' <> semi) $$ pprForeignCall fn cconv hresults hargs | otherwise = pprCall fn cconv hresults hargs @@ -1005,7 +1005,8 @@ pprExternDecl _in_srt lbl hcat [ visibility, label_type lbl, lparen, ppr lbl, text ");" ] where - label_type lbl | isCFunctionLabel lbl = text "F_" + label_type lbl | isForeignLabel lbl && isCFunctionLabel lbl = text "FF_" + | isCFunctionLabel lbl = text "F_" | otherwise = text "I_" visibility |