diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2016-04-16 15:25:07 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-04-16 15:34:30 +0200 |
commit | bf17fd0e5b5442a87f507b26e64a30c79732838a (patch) | |
tree | 9d1dbe467d38a35307e8262802439ff1d20ddf65 /utils/deriveConstants/Main.hs | |
parent | d77981ed4347e5feb0497d8161af72f8f5e10b65 (diff) | |
download | haskell-bf17fd0e5b5442a87f507b26e64a30c79732838a.tar.gz |
deriveConstants: Verify sanity of nm
Add a sanity check ensuring that nm emits valid hexadecimal output, as
required by POSIX. See #11744 for motivation.
Reviewers: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2113
GHC Trac Issues: #11744
Diffstat (limited to 'utils/deriveConstants/Main.hs')
-rw-r--r-- | utils/deriveConstants/Main.hs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 6a88ac2d17..96da16631e 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -296,8 +296,12 @@ haskellise "" = "" wanteds :: String -> Wanteds wanteds os = concat - [-- Closure header sizes. - constantWord Both "STD_HDR_SIZE" + [-- Control group constant for integrity check; this + -- round-tripped constant is used for testing that + -- derivedConstant works as expected + constantWord Both "CONTROL_GROUP_CONST_291" "0x123" + -- Closure header sizes. + ,constantWord Both "STD_HDR_SIZE" -- grrr.. PROFILING is on so we need to -- subtract sizeofW(StgProfHeader) "sizeofW(StgHeader) - sizeofW(StgProfHeader)" @@ -682,6 +686,14 @@ getWanted verbose os tmpdir gccProgram gccFlags nmProgram mobjdumpProgram m = Map.fromList $ case os of "aix" -> parseAixObjdump ls _ -> catMaybes $ map parseNmLine ls + + case Map.lookup "CONTROL_GROUP_CONST_291" m of + Just 292 -> return () -- OK + Nothing -> die "CONTROL_GROUP_CONST_291 missing!" + Just 0x292 -> die $ "broken 'nm' detected, see https://ghc.haskell.org/ticket/11744.\n" + ++ "Workaround: You may want to pass '--with-nm=nm-classic' to 'configure'." + Just x -> die ("unexpected value round-tripped for CONTROL_GROUP_CONST_291: " ++ show x) + rs <- mapM (lookupResult m) (wanteds os) return rs where headers = ["#define IN_STG_CODE 0", |