Commit f49271c0 authored by ian@well-typed.com's avatar ian@well-typed.com

Replace mkDerivedConstants.c with DeriveConstants.hs

DeriveConstants.hs works in a cross-compilation-friendly way. Rather
than running a C program that prints out the constants, we just compile
a C file which has the constants are encoded in symbol sizes. We then
parse the output of 'nm' to find out what the constants are.

Based on work by Gabor Greif <ggreif@gmail.com>.
parent b78b6b34
......@@ -28,6 +28,16 @@ ifneq "$(BINDIST)" "YES"
compiler/stage1/package-data.mk : compiler/stage1/build/Config.hs
compiler/stage2/package-data.mk : compiler/stage2/build/Config.hs
compiler/stage3/package-data.mk : compiler/stage3/build/Config.hs
compiler/stage1/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_TYPE)
compiler/stage2/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_TYPE)
compiler/stage3/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_TYPE)
compiler/stage1/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_EXPORTS)
compiler/stage2/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_EXPORTS)
compiler/stage3/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_EXPORTS)
compiler/stage1/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_WRAPPERS)
compiler/stage2/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_WRAPPERS)
compiler/stage3/build/DynFlags.o: $(includes_GHCCONSTANTS_HASKELL_WRAPPERS)
endif
compiler/stage%/build/Config.hs : mk/config.mk mk/project.mk | $$(dir $$@)/.
......
......@@ -1248,7 +1248,7 @@ defaultDynFlags mySettings =
}
defaultWays :: Settings -> [Way]
defaultWays settings = if pc_dYNAMIC_BY_DEFAULT (sPlatformConstants settings)
defaultWays settings = if pc_DYNAMIC_BY_DEFAULT (sPlatformConstants settings)
then [WayDyn]
else []
......@@ -2571,7 +2571,7 @@ defaultFlags settings
++ default_PIC platform
++ (if pc_dYNAMIC_BY_DEFAULT (sPlatformConstants settings)
++ (if pc_DYNAMIC_BY_DEFAULT (sPlatformConstants settings)
then wayGeneralFlags platform WayDyn
else [Opt_Static])
......
......@@ -662,6 +662,7 @@ BUILD_DIRS += \
$(MAYBE_COMPILER) \
$(GHC_HSC2HS_DIR) \
$(GHC_PKG_DIR) \
utils/deriveConstants \
utils/testremove \
$(MAYBE_GHCTAGS) \
utils/ghc-pwd \
......@@ -1294,6 +1295,7 @@ distclean : clean
$(call removeFiles,libraries/unix/include/HsUnixConfig.h)
$(call removeFiles,libraries/old-time/include/HsTimeConfig.h)
$(call removeTrees,utils/ghc-pwd/dist-boot)
$(call removeTrees,includes/dist-derivedconstants)
$(call removeTrees,inplace)
$(call removeTrees,$(patsubst %, libraries/%/autom4te.cache, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
......
......@@ -143,79 +143,45 @@ includes_GHCCONSTANTS_HASKELL_VALUE = includes/dist-derivedconstants/header/plat
includes_GHCCONSTANTS_HASKELL_WRAPPERS = includes/dist-derivedconstants/header/GHCConstantsHaskellWrappers.hs
includes_GHCCONSTANTS_HASKELL_EXPORTS = includes/dist-derivedconstants/header/GHCConstantsHaskellExports.hs
INSTALL_LIBS += includes/dist-derivedconstants/header/platformConstants
INSTALL_LIBS += $(includes_GHCCONSTANTS_HASKELL_VALUE)
ifeq "$(PORTING_HOST)-$(AlienScript)" "YES-"
DerivedConstants.h :
@echo "*** Cross-compiling: please copy DerivedConstants.h from the target system"
@exit 1
else
includes_dist-derivedconstants_C_SRCS = mkDerivedConstants.c
includes_dist-derivedconstants_PROG = mkDerivedConstants$(exeext)
includes_dist-derivedconstants_INSTALL_INPLACE = YES
$(eval $(call build-prog,includes,dist-derivedconstants,0))
$(includes_dist-derivedconstants_depfile_c_asm) : $(includes_H_CONFIG) $(includes_H_PLATFORM) $(includes_H_FILES) $$(rts_H_FILES)
includes/dist-derivedconstants/build/mkDerivedConstants.o : $(includes_H_CONFIG) $(includes_H_PLATFORM)
ifneq "$(AlienScript)" ""
$(INPLACE_BIN)/mkDerivedConstants$(exeext): includes/$(includes_dist-derivedconstants_C_SRCS) | $$(dir $$@)/.
$(WhatGccIsCalled) -o $@ $< $(CFLAGS) $(includes_CC_OPTS)
endif
DERIVE_CONSTANTS_FLAGS += --gcc-program "$(WhatGccIsCalled)"
DERIVE_CONSTANTS_FLAGS += $(addprefix --gcc-flag$(space),$(includes_CC_OPTS) -fcommon)
DERIVE_CONSTANTS_FLAGS += --nm-program "$(NM)"
ifneq "$(BINDIST)" "YES"
$(includes_DERIVEDCONSTANTS) : $(INPLACE_BIN)/mkDerivedConstants$(exeext) | $$(dir $$@)/.
ifeq "$(AlienScript)" ""
./$< >$@
else
$(AlienScript) run ./$< >$@
endif
$(includes_DERIVEDCONSTANTS): $$(includes_H_CONFIG) $$(includes_H_PLATFORM) $$(includes_H_FILES) $$(rts_H_FILES)
$(includes_GHCCONSTANTS_HASKELL_VALUE): $$(includes_H_CONFIG) $$(includes_H_PLATFORM) $$(includes_H_FILES) $$(rts_H_FILES)
$(includes_GHCCONSTANTS_HASKELL_TYPE) : $(INPLACE_BIN)/mkDerivedConstants$(exeext) | $$(dir $$@)/.
ifeq "$(AlienScript)" ""
./$< --gen-haskell-type >$@
else
$(AlienScript) run ./$< --gen-haskell-type >$@
endif
$(includes_DERIVEDCONSTANTS): $(INPLACE_BIN)/deriveConstants$(exeext) | $$(dir $$@)/.
$< --gen-header -o $@ --tmpdir $(dir $@) $(DERIVE_CONSTANTS_FLAGS)
$(includes_GHCCONSTANTS_HASKELL_VALUE) : $(INPLACE_BIN)/mkDerivedConstants$(exeext) | $$(dir $$@)/.
ifeq "$(AlienScript)" ""
./$< --gen-haskell-value >$@
else
$(AlienScript) run ./$< --gen-haskell-value >$@
endif
$(includes_GHCCONSTANTS_HASKELL_TYPE): $(INPLACE_BIN)/deriveConstants$(exeext) | $$(dir $$@)/.
$< --gen-haskell-type -o $@ --tmpdir $(dir $@) $(DERIVE_CONSTANTS_FLAGS)
$(includes_GHCCONSTANTS_HASKELL_WRAPPERS) : $(INPLACE_BIN)/mkDerivedConstants$(exeext) | $$(dir $$@)/.
ifeq "$(AlienScript)" ""
./$< --gen-haskell-wrappers >$@
else
$(AlienScript) run ./$< --gen-haskell-wrappers >$@
endif
$(includes_GHCCONSTANTS_HASKELL_VALUE): $(INPLACE_BIN)/deriveConstants$(exeext) | $$(dir $$@)/.
$< --gen-haskell-value -o $@ --tmpdir $(dir $@) $(DERIVE_CONSTANTS_FLAGS)
$(includes_GHCCONSTANTS_HASKELL_EXPORTS) : $(INPLACE_BIN)/mkDerivedConstants$(exeext) | $$(dir $$@)/.
ifeq "$(AlienScript)" ""
./$< --gen-haskell-exports >$@
else
$(AlienScript) run ./$< --gen-haskell-exports >$@
endif
endif
$(includes_GHCCONSTANTS_HASKELL_WRAPPERS): $(INPLACE_BIN)/deriveConstants$(exeext) | $$(dir $$@)/.
$< --gen-haskell-wrappers -o $@ --tmpdir $(dir $@) $(DERIVE_CONSTANTS_FLAGS)
$(includes_GHCCONSTANTS_HASKELL_EXPORTS): $(INPLACE_BIN)/deriveConstants$(exeext) | $$(dir $$@)/.
$< --gen-haskell-exports -o $@ --tmpdir $(dir $@) $(DERIVE_CONSTANTS_FLAGS)
endif
# ---------------------------------------------------------------------------
# Install all header files
$(eval $(call clean-target,includes,,\
$(includes_H_CONFIG) $(includes_H_PLATFORM) \
$(includes_GHCCONSTANTS_HASKELL_TYPE) $(includes_GHCCONSTANTS_HASKELL_VALUE) $(includes_DERIVEDCONSTANTS)))
$(includes_H_CONFIG) $(includes_H_PLATFORM)))
$(eval $(call all-target,includes,,\
$(includes_H_CONFIG) $(includes_H_PLATFORM) \
$(includes_GHCCONSTANTS_HASKELL_TYPE) $(includes_GHCCONSTANTS_HASKELL_VALUE) $(includes_DERIVEDCONSTANTS)))
$(includes_GHCCONSTANTS_HASKELL_TYPE) \
$(includes_GHCCONSTANTS_HASKELL_VALUE) \
$(includes_GHCCONSTANTS_HASKELL_WRAPPERS) \
$(includes_GHCCONSTANTS_HASKELL_EXPORTS) \
$(includes_DERIVEDCONSTANTS)))
install: install_includes
......
This diff is collapsed.
## This script rewrites normal C structs into successively
## greater ones so that field offset computation becomes a
## sizeof lookup and thus amenable to compile-time computations.
## Usage: pipe stg/Regs.h into 'awk' running this script
## to obtain a .c file that can be compiled to .o
## with the gcc from the cross toolchain. Then
## use another 'awk' script to process the 'nm'
## output of the object file.
## Motivation: since in general we can not run executables
## created by the cross toolchain, we need another
## way of finding out field offsets and type sizes
## of the target platform.
BEGIN {
interesting = 0
seed = 0
print "/* this file is generated by mkDerivedConstants.cross.awk, do not touch */"
print "/* needs to be compiled with the target gcc */"
print ""
print "#include \"Rts.h\""
print "#include \"Capability.h\""
print ""
## these do not have a proper typedef; supply them here
print "#define FLAG_STRUCT_TYPE(IT) typedef struct IT ## _FLAGS IT ## _FLAGS"
print "FLAG_STRUCT_TYPE(GC);"
print "FLAG_STRUCT_TYPE(DEBUG);"
print "FLAG_STRUCT_TYPE(COST_CENTRE);"
print "FLAG_STRUCT_TYPE(PROFILING);"
print "FLAG_STRUCT_TYPE(TRACE);"
print "FLAG_STRUCT_TYPE(CONCURRENT);"
print "FLAG_STRUCT_TYPE(MISC);"
print "FLAG_STRUCT_TYPE(PAR);"
print "FLAG_STRUCT_TYPE(TICKY);"
## these we do know how to get the field size,
## so do not bother mining it
print "#define DO_NOT_MINE_UNION_MEMBER(STRUCT, NESTED_MEMBER, ID) char nestedfieldsize$ ## STRUCT ## $ ## ID [sizeof ((STRUCT*)0)->NESTED_MEMBER]"
print "DO_NOT_MINE_UNION_MEMBER(StgHeader, prof.hp.ldvw, prof_hp_ldvw);"
print "DO_NOT_MINE_UNION_MEMBER(StgFunInfoExtraFwd, b.bitmap, b_bitmap);"
print "DO_NOT_MINE_UNION_MEMBER(StgFunInfoExtraRev, b.bitmap, b_bitmap);"
}
## pass through embedded unions
eat_union && /^[ \t]*}[ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t]*;[ \t]*$/ {
sub(/^[ \t]*}[ \t]*/, "")
sub(/[ \t]*;[ \t]*$/, "")
new_offset_struct_name = struct_name $0
print ""
eat_union = 0
if (!offset_struct_name)
{
print "char starting" new_offset_struct_name "[2];"
}
else
{
assumptions = assumptions "\n" "char sizeof" new_offset_struct_name "[offsetof(^^^, " $0 ")];"
assumptions = assumptions "\n" "typedef char verify_size" new_offset_struct_name "[sizeof sizeof" new_offset_struct_name " == offsetof(^^^, " $0 ") ? 1 : -1];"
}
offset_struct_name = new_offset_struct_name
next
}
eat_union {
next
}
/# [0-9]* "rts\// {
ours = 1
next
}
/# [0-9]* "includes\// {
ours = 1
next
}
## filter out non-ghc headers
/# [0-9]* "/ {
ours = 0
next
}
!ours {
next
}
!interesting {
struct_name = "$" seed "$"
offset_struct_name = ""
known_struct_name = ""
eat_union = 0
assumptions = ""
}
## kill empty line
/^[ \t]*$/ {
next
}
/^# [0-9]/ {
print
next
}
/^typedef struct[ \t][ \t]*[_0-9a-zA-Z]*[ \t]*{[ \t]*$/ {
if (interesting) error "previous struct not closed?"
interesting = 1
print ""
print "/* ### Creating offset structs for " $3 " ### */"
next
}
/^struct[ \t][ \t]*[_0-9a-zA-Z]*[ \t]*{[ \t]*$/ {
if (interesting) error "previous struct not closed?"
interesting = 1
known_struct_name = $2
sub(/_$/, "", known_struct_name);
print ""
print "/* ### Creating offset structs for " known_struct_name " ### */"
print "char associate$" known_struct_name "$" seed ";"
next
}
## end of struct
##
interesting && /^[ \t]*}[ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t]*;[ \t]*$/{
sub(/;$/, "", $2)
print "char associate$" $2 "$" seed ";"
print "char SIZEOF$" seed "[sizeof(" $2 ")];"
print ""
print ""
gsub(/\^\^\^/, $2, assumptions);
print assumptions
++seed
interesting = 0
next
}
## Ptr-typedef
interesting && /^[ \t]*}[ \t]*\*[_0-9a-zA-Z][_0-9a-zA-Z]*Ptr[ \t]*;[ \t]*$/{
sub(/Ptr;$/, "", $2)
sub(/^\*/, "", $2)
print "char associate$" $2 "$" seed ";"
print "char SIZEOF$" seed "[sizeof(" $2 ")];"
print ""
print ""
gsub(/\^\^\^/, $2, assumptions);
print assumptions
++seed
interesting = 0
next
}
interesting && /^[ \t]*}[; \t]*$/ {
print "char SIZEOF$" seed "[sizeof(" known_struct_name ")];"
print ""
print ""
gsub(/\^\^\^/, known_struct_name, assumptions);
print assumptions
++seed
interesting = 0
}
# collapse whitespace after '*'
interesting {
# normalize some types
sub(/struct StgClosure_[ \t]*\*/, "StgClosure *")
gsub(/\*[ \t]*volatile/, "*")
# group stars together
gsub(/\*[ \t]*/, "*")
sub(/\*/, " *")
print "// " $0
# remove volatile
sub(/[ \t]volatile[ \t]/, " ")
# remove const
sub(/[ \t]const[ \t]/, " ")
}
## (pointer to struct) member of struct
##
interesting && /^[ \t]*struct[ \t][ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t]*\*[ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t]*;[ \t]*$/ {
if (!$4) {
sub(/^\*/, "", $3)
$4 = $3
}
sub(/;$/, "", $4)
new_offset_struct_name = struct_name $4
print ""
if (!offset_struct_name)
{
print "char starting" new_offset_struct_name "[2];"
}
else
{
assumptions = assumptions "\n" "char sizeof" new_offset_struct_name "[offsetof(^^^, " $4 ")];"
assumptions = assumptions "\n" "typedef char verify_size" new_offset_struct_name "[sizeof sizeof" new_offset_struct_name " == offsetof(^^^, " $4 ") ? 1 : -1];"
}
print "char fieldsize" new_offset_struct_name "[sizeof(struct " $2 "*)];"
print ""
print ""
offset_struct_name = new_offset_struct_name
next
}
## (simple pointer) member of struct
##
interesting && /^[ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t][ \t]*\*\**[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t]*;[ \t]*$/ {
sub(/;$/, "", $2)
sub(/^\**/, "", $2)
new_offset_struct_name = struct_name $2
print ""
if (!offset_struct_name)
{
print "char starting" new_offset_struct_name "[2];"
}
else
{
assumptions = assumptions "\n" "char sizeof" new_offset_struct_name "[offsetof(^^^, " $2 ")];"
assumptions = assumptions "\n" "typedef char verify_size" new_offset_struct_name "[sizeof sizeof" new_offset_struct_name " == offsetof(^^^, " $2 ") ? 1 : -1];"
}
print "char fieldsize" new_offset_struct_name "[sizeof(" $1 "*)];"
print ""
print ""
offset_struct_name = new_offset_struct_name
next
}
## member of struct
##
interesting && /^[ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t][ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*;[ \t]*$/ {
sub(/;$/, "", $2)
new_offset_struct_name = struct_name $2
print ""
if (!offset_struct_name)
{
print "char starting" new_offset_struct_name "[2];"
}
else
{
assumptions = assumptions "\n" "char sizeof" new_offset_struct_name "[offsetof(^^^, " $2 ")];"
assumptions = assumptions "\n" "typedef char verify_size" new_offset_struct_name "[sizeof sizeof" new_offset_struct_name " == offsetof(^^^, " $2 ") ? 1 : -1];"
}
print "char fieldsize" new_offset_struct_name "[sizeof(" $1 ")];"
print ""
print ""
offset_struct_name = new_offset_struct_name
next
}
## struct member of struct
##
interesting && /^[ \t]*struct[ \t][ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t][ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*;[ \t]*$/ {
sub(/;$/, "", $3)
new_offset_struct_name = struct_name $3
print ""
if (!offset_struct_name)
{
print "char starting" new_offset_struct_name "[2];"
}
else
{
assumptions = assumptions "\n" "char sizeof" new_offset_struct_name "[offsetof(^^^, " $3 ")];"
assumptions = assumptions "\n" "typedef char verify_size" new_offset_struct_name "[sizeof sizeof" new_offset_struct_name " == offsetof(^^^, " $3 ") ? 1 : -1];"
}
print "char fieldsize" new_offset_struct_name "[sizeof(struct " $2 ")];"
print ""
print ""
offset_struct_name = new_offset_struct_name
next
}
## embedded union
interesting && /^[ \t]*union[ \t]*{[ \t]*$/ {
eat_union = 1
next
}
## array member
interesting && /^[ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t][ \t]*\**[_0-9a-zA-Z][_0-9a-zA-Z]*\[.*\];[ \t]*$/ {
sub(/;[ \t]*$/, "", $0)
full = $0
sub(/^[ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t][ \t]*/, "", full)
split(full, parts, "[")
mname = parts[1]
sub(/^\**/, "", mname)
new_offset_struct_name = struct_name mname
print ""
if (!offset_struct_name)
{
print "char starting" new_offset_struct_name "[2];"
}
else
{
assumptions = assumptions "\n" "char sizeof" new_offset_struct_name "[offsetof(^^^, " mname ")];"
assumptions = assumptions "\n" "typedef char verify_size" new_offset_struct_name "[sizeof sizeof" new_offset_struct_name " == offsetof(^^^, " mname ") ? 1 : -1];"
}
print ""
print ""
offset_struct_name = new_offset_struct_name
next
}
## padded member of struct
## of this form: StgHalfInt slow_apply_offset; StgHalfWord __pad_slow_apply_offset;;
##
interesting && /^[ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t][ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*;[ \t]*[_0-9a-zA-Z][_0-9a-zA-Z]*[ \t][ \t]*__pad_[a-zA-Z][_0-9a-zA-Z]*;;*[ \t]*$/ {
mname = $2
sub(/;$/, "", mname)
new_offset_struct_name = struct_name mname
print ""
if (!offset_struct_name)
{
print "char starting" new_offset_struct_name "[2];"
}
else
{
assumptions = assumptions "\n" "char sizeof" new_offset_struct_name "[offsetof(^^^, " mname ")];"
assumptions = assumptions "\n" "typedef char verify_size" new_offset_struct_name "[sizeof sizeof" new_offset_struct_name " == offsetof(^^^, " mname ") ? 1 : -1];"
}
print ""
print ""
offset_struct_name = new_offset_struct_name
next
}
interesting && /;[ \t]*$/ {
print "Member not recognized: " $0 > "/dev/stderr"
exit 1
}
\ No newline at end of file
BEGIN {
print "#define OFFSET(s_type, field) OFFSET_ ## s_type ## _ ## field"
print "#define FIELD_SIZE(s_type, field) FIELD_SIZE_ ## s_type ## _ ## field"
print "#define TYPE_SIZE(type) TYPE_SIZE_ ## type"
print ""
}
/^0[0-9a-zA-Z]* C _*associate\$/ {
sub(/_*associate\$/, "", $3)
split($3, arr, "$")
assoc[arr[2]] = arr[1]
next
}
/^00*2 C _*starting\$[0-9]*\$[_0-9a-zA-Z]*$/ {
sub(/_*starting\$/, "", $3)
split($3, arr, "$")
sub(/^0*/, "", $1)
print "#define OFFSET_" assoc[arr[1]] "_" arr[2] " 0x0"
next
}
/^0[0-9a-zA-Z]* C _*sizeof\$[0-9]*\$[_0-9a-zA-Z]*$/ {
sub(/_*sizeof\$/, "", $3)
split($3, arr, "$")
sub(/^0*/, "", $1)
print "#define OFFSET_" assoc[arr[1]] "_" arr[2] " 0x" $1
next
}
/^0[0-9a-zA-Z]* C _*fieldsize\$[0-9]*\$[_0-9a-zA-Z]*$/ {
sub(/_*fieldsize\$/, "", $3)
split($3, arr, "$")
sub(/^0*/, "", $1)
print "#define FIELD_SIZE_" assoc[arr[1]] "_" arr[2] " 0x" $1 "UL"
next
}
/^0[0-9a-zA-Z]* C _*nestedfieldsize\$[_0-9a-zA-Z]*\$[_0-9a-zA-Z]*$/ {
sub(/_*nestedfieldsize\$/, "", $3)
split($3, arr, "$")
sub(/^0*/, "", $1)
print "#define FIELD_SIZE_" arr[1] "_" arr[2] " 0x" $1 "UL"
next
}
/^0[0-9a-zA-Z]* C _*SIZEOF\$[0-9]*$/ {
sub(/_*SIZEOF\$/, "", $3)
sub(/^0*/, "", $1)
print "#define TYPE_SIZE_" assoc[$3] " 0x" $1
next
}
{ print "// " $0 }
END {
## some indirect offsets
print "#define OFFSET_StgHeader_prof_ccs (OFFSET_StgHeader_prof + OFFSET_StgProfHeader_ccs)"
print "#define OFFSET_StgHeader_prof_hp_ldvw (OFFSET_StgHeader_prof + OFFSET_StgProfHeader_hp + 0)"
print "#define OFFSET_StgTSO_prof_cccs (OFFSET_StgTSO_prof + OFFSET_StgTSOProfInfo_cccs)"
print "#define OFFSET_RTS_FLAGS_ProfFlags_showCCSOnException (OFFSET_RTS_FLAGS_ProfFlags + OFFSET_PROFILING_FLAGS_showCCSOnException)"
print "#define OFFSET_RTS_FLAGS_DebugFlags_apply (OFFSET_RTS_FLAGS_DebugFlags + OFFSET_DEBUG_FLAGS_apply)"
print "#define OFFSET_RTS_FLAGS_DebugFlags_sanity (OFFSET_RTS_FLAGS_DebugFlags + OFFSET_DEBUG_FLAGS_sanity)"
print "#define OFFSET_RTS_FLAGS_DebugFlags_weak (OFFSET_RTS_FLAGS_DebugFlags + OFFSET_DEBUG_FLAGS_weak)"
print "#define OFFSET_RTS_FLAGS_GcFlags_initialStkSize (OFFSET_RTS_FLAGS_GcFlags + OFFSET_GC_FLAGS_initialStkSize)"
print "#define OFFSET_RTS_FLAGS_MiscFlags_tickInterval (OFFSET_RTS_FLAGS_MiscFlags + OFFSET_MISC_FLAGS_tickInterval)"
print "#define OFFSET_StgFunInfoExtraFwd_b_bitmap (OFFSET_StgFunInfoExtraFwd_b + 0)"
print "#define OFFSET_StgFunInfoExtraRev_b_bitmap (OFFSET_StgFunInfoExtraRev_b + 0)"
## some indirect field sizes
print "#define FIELD_SIZE_StgHeader_prof_ccs FIELD_SIZE_StgProfHeader_ccs"
print "#define FIELD_SIZE_StgTSO_prof_cccs FIELD_SIZE_StgTSOProfInfo_cccs"
print "#define FIELD_SIZE_RTS_FLAGS_ProfFlags_showCCSOnException FIELD_SIZE_PROFILING_FLAGS_showCCSOnException"
print "#define FIELD_SIZE_RTS_FLAGS_DebugFlags_apply FIELD_SIZE_DEBUG_FLAGS_apply"
print "#define FIELD_SIZE_RTS_FLAGS_DebugFlags_sanity FIELD_SIZE_DEBUG_FLAGS_sanity"
print "#define FIELD_SIZE_RTS_FLAGS_DebugFlags_weak FIELD_SIZE_DEBUG_FLAGS_weak"
print "#define FIELD_SIZE_RTS_FLAGS_GcFlags_initialStkSize FIELD_SIZE_GC_FLAGS_initialStkSize"
print "#define FIELD_SIZE_RTS_FLAGS_MiscFlags_tickInterval FIELD_SIZE_MISC_FLAGS_tickInterval"
}
This diff is collapsed.
# -----------------------------------------------------------------------------
#
# (c) 2009-1012 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
#
# -----------------------------------------------------------------------------
dir = utils/deriveConstants
TOP = ../..
include $(TOP)/mk/sub-makefile.mk
# -----------------------------------------------------------------------------
#
# (c) 2009-2012 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
#
# -----------------------------------------------------------------------------
utils/deriveConstants_dist_MODULES = DeriveConstants
utils/deriveConstants_dist_PROG = deriveConstants
utils/deriveConstants_dist_INSTALL_INPLACE = YES
utils/deriveConstants_HC_OPTS += -package process -package containers
$(eval $(call build-prog,utils/deriveConstants,dist,0))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment