Parser.y.pp needs special treatment with -fcmm-sink
This bug is really more of a reminder, but it's critical for the 7.8.1 release.
Right now, Parser.y.pp
uses a very weird hack to pass -fcmm-sink
to the compiler. Here's the relevant comment:
-- CPP tricks because we want the directives in the output of the
-- first CPP pass.
--
-- Clang note, 6/17/2013 by aseipp: It is *extremely* important (for
-- some reason) that there be a line of whitespace between the two
-- definitions here, and the subsequent use of __IF_GHC_77__ - this
-- seems to be a bug in clang or something, where having the line of
-- whitespace will make the preprocessor correctly format the rendered
-- lines in the 'two step' CPP pass. No, this is not a joke.
#define __IF_GHC_77__ #if __GLASGOW_HASKELL__ >= 707
#define __ENDIF__ #endif
__IF_GHC_77__
-- Required on x86 to avoid the register allocator running out of
-- stack slots when compiling this module with -fPIC -dynamic.
{-# OPTIONS_GHC -fcmm-sink #-}
__ENDIF__
This is because the parser is first preprocessed before being run with GHC (which again preprocesses,) so we want the resulting #ifdef
in the final .hs
file.
Things to note:
- We really shouldn't be doing this, it's amazingly fragile. I think the correct thing to do is to ensure the build system correctly passes
-fcmm-sink
during the stage[2,3] build. -
./configure.ac
needs to check to see if the bootstrapping compiler isghc >= 7.7
(or7.8
) and if it is, also pass-fcmm-sink
during the stage1 build. - This hack needs to be removed once we can rely on >= 7.8 for bootstrap. Probably something like the hypothetical 7.12-7.14 timeframe.
Trac metadata
Trac field | Value |
---|---|
Version | 7.7 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | highest |
Resolution | Unresolved |
Component | Build System |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |