[commit: ghc] master: UNREG: fix "_bytes" string literal forward declaration (34a0205)
git at git.haskell.org
git at git.haskell.org
Sun Jan 29 19:46:20 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/34a0205587c8c6017a26ddf7023e91789da2e81b/ghc
>---------------------------------------------------------------
commit 34a0205587c8c6017a26ddf7023e91789da2e81b
Author: Sergei Trofimovich <siarheit at google.com>
Date: Sun Jan 29 18:39:48 2017 +0000
UNREG: fix "_bytes" string literal forward declaration
Typical UNREG build failure looks like that:
ghc-unreg/includes/Stg.h:226:46: error:
note: in definition of macro 'EI_'
#define EI_(X) extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
^
|
226 | #define EI_(X) extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
| ^
/tmp/ghc10489_0/ghc_3.hc:1754:6: error:
note: previous definition of 'ghczmprim_GHCziTypes_zdtcTyCon2_bytes' was here
char ghczmprim_GHCziTypes_zdtcTyCon2_bytes[] = "TyCon";
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
1754 | char ghczmprim_GHCziTypes_zdtcTyCon2_bytes[] = "TyCon";
| ^
As we see here "_bytes" string literals are defined as 'char []'
array, not 'StgWord []'.
The change special-cases "_bytes" string literals to have
correct declaration type.
Signed-off-by: Sergei Trofimovich <siarheit at google.com>
>---------------------------------------------------------------
34a0205587c8c6017a26ddf7023e91789da2e81b
compiler/cmm/CLabel.hs | 6 ++++++
compiler/cmm/PprC.hs | 3 ++-
includes/Stg.h | 1 +
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
index ee87ef1..2f38203 100644
--- a/compiler/cmm/CLabel.hs
+++ b/compiler/cmm/CLabel.hs
@@ -89,6 +89,7 @@ module CLabel (
addLabelSize,
foreignLabelStdcallInfo,
+ isBytesLabel,
isForeignLabel,
mkCCLabel, mkCCSLabel,
@@ -573,6 +574,11 @@ addLabelSize (ForeignLabel str _ src fod) sz
addLabelSize label _
= label
+-- | Whether label is a top-level string literal
+isBytesLabel :: CLabel -> Bool
+isBytesLabel (IdLabel _ _ Bytes) = True
+isBytesLabel _lbl = False
+
-- | Whether label is a non-haskell label (defined in C code)
isForeignLabel :: CLabel -> Bool
isForeignLabel (ForeignLabel _ _ _ _) = True
diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
index 6380451..811d908 100644
--- a/compiler/cmm/PprC.hs
+++ b/compiler/cmm/PprC.hs
@@ -1007,7 +1007,8 @@ pprExternDecl _in_srt lbl
hcat [ visibility, label_type lbl,
lparen, ppr lbl, text ");" ]
where
- label_type lbl | isForeignLabel lbl && isCFunctionLabel lbl = text "FF_"
+ label_type lbl | isBytesLabel lbl = text "B_"
+ | isForeignLabel lbl && isCFunctionLabel lbl = text "FF_"
| isCFunctionLabel lbl = text "F_"
| otherwise = text "I_"
diff --git a/includes/Stg.h b/includes/Stg.h
index f1949b1..e3de331 100644
--- a/includes/Stg.h
+++ b/includes/Stg.h
@@ -223,6 +223,7 @@ typedef StgInt I_;
typedef StgWord StgWordArray[];
typedef StgFunPtr F_;
+#define EB_(X) extern char X[]
#define EI_(X) extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
#define II_(X) static StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
#define IF_(f) static StgFunPtr GNUC3_ATTRIBUTE(used) f(void)
More information about the ghc-commits
mailing list