Problem about `DerivedConstants.h` and `tmp.c` in `includes/dist-derivedconstants/header`, GHC 7.8.3

Reid Barton rwbarton at gmail.com
Tue Jun 16 13:09:43 UTC 2015


On Sat, Jun 13, 2015 at 9:44 AM, Zhen Zhang <izgzhen at gmail.com> wrote:

> Hi everyone,
>
> I am having trouble porting some 6.8.2 GHC code to 7.8.3 GHC. The main
> trouble I met is that, in 6.8.2, there is a includes/mkDerivedConstants.c and
> some constants about RTS are declared here.
>
> While in 7.8.3, there is only a
> similar  `includes/dist-derivedconstants/header` directory containing a
> bunch of code. Some seems generated like `DerivedConstants.h`, and it seems
> like `tmp.c` generated this.
>
> However, when I added some entries in `tmp.c` and compiled it, then it
> became the original version ... So I doubted that if there is another file
> which is equivalent to the includes/mkDerivedConstants.c in 6.8.2?
>

Hi Zhen,

Take a look at utils/deriveConstants/DeriveConstants.hs. That program
generates tmp.c, then compiles it with the C compiler and inspects the
sizes of symbols in the resulting object file and writes the information it
gathered to DerivedConstants.h. We do it this way now to support
cross-compilation (in that case, the C compiler generates object files for
the target platform so we can't simply run them on the system that is
building GHC).

Regards,
Reid Barton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20150616/3a81f1c0/attachment.html>


More information about the ghc-devs mailing list