From f64aaa7b4230cec62f0679ddf998fe79e0a42820 Mon Sep 17 00:00:00 2001 From: "Ben.Lippmeier@anu.edu.au" Date: Tue, 17 Nov 2009 04:37:16 +0000 Subject: [PATCH] Use opt_PIC not #defined __PIC__ in compiler source. --- compiler/codeGen/CgCon.lhs | 8 ++++++-- compiler/codeGen/StgCmmCon.hs | 11 ++++++++--- compiler/main/DriverPipeline.hs | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/compiler/codeGen/CgCon.lhs b/compiler/codeGen/CgCon.lhs index 36c851d..0981811 100644 --- a/compiler/codeGen/CgCon.lhs +++ b/compiler/codeGen/CgCon.lhs @@ -171,9 +171,11 @@ because they don't support cross package data references well. \begin{code} -#if !(defined(__PIC__) && defined(mingw32_HOST_OS)) buildDynCon binder _ con [arg_amode] | maybeIntLikeCon con +#if defined(mingw32_TARGET_OS) + , not opt_PIC +#endif , (_, CmmLit (CmmInt val _)) <- arg_amode , let val_int = (fromIntegral val) :: Int , val_int <= mAX_INTLIKE && val_int >= mIN_INTLIKE @@ -185,6 +187,9 @@ buildDynCon binder _ con [arg_amode] buildDynCon binder _ con [arg_amode] | maybeCharLikeCon con +#if defined(mingw32_TARGET_OS) + , not opt_PIC +#endif , (_, CmmLit (CmmInt val _)) <- arg_amode , let val_int = (fromIntegral val) :: Int , val_int <= mAX_CHARLIKE && val_int >= mIN_CHARLIKE @@ -193,7 +198,6 @@ buildDynCon binder _ con [arg_amode] -- CHARLIKE closures consist of a header and one word payload charlike_amode = CmmLit (cmmLabelOffW charlike_lbl offsetW) ; returnFC (taggedStableIdInfo binder charlike_amode (mkConLFInfo con) con) } -#endif \end{code} diff --git a/compiler/codeGen/StgCmmCon.hs b/compiler/codeGen/StgCmmCon.hs index 18c2509..3226f0c 100644 --- a/compiler/codeGen/StgCmmCon.hs +++ b/compiler/codeGen/StgCmmCon.hs @@ -39,6 +39,7 @@ import Literal import PrelInfo import Outputable import Util ( lengthIs ) +import StaticFlags ( opt_PIC ) import Data.Char @@ -153,9 +154,11 @@ We don't support this optimisation when compiling into Windows DLLs yet because they don't support cross package data references well. -} -#if !(defined(__PIC__) && defined(mingw32_HOST_OS)) buildDynCon binder _cc con [arg] | maybeIntLikeCon con +#if defined(mingw32_TARGET_OS) + , not opt_PIC +#endif , StgLitArg (MachInt val) <- arg , val <= fromIntegral mAX_INTLIKE -- Comparisons at type Integer! , val >= fromIntegral mIN_INTLIKE -- ...ditto... @@ -167,7 +170,10 @@ buildDynCon binder _cc con [arg] ; return (litIdInfo binder (mkConLFInfo con) intlike_amode, mkNop) } buildDynCon binder _cc con [arg] - | maybeCharLikeCon con + | maybeCharLikeCon con +#if defined(mingw32_TARGET_OS) + , not opt_PIC +#endif , StgLitArg (MachChar val) <- arg , let val_int = ord val :: Int , val_int <= mAX_CHARLIKE @@ -177,7 +183,6 @@ buildDynCon binder _cc con [arg] -- CHARLIKE closures consist of a header and one word payload charlike_amode = cmmLabelOffW charlike_lbl offsetW ; return (litIdInfo binder (mkConLFInfo con) charlike_amode, mkNop) } -#endif -------- buildDynCon: the general case ----------- buildDynCon binder ccs con args diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 1d94b49..042fa04 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -997,7 +997,7 @@ runPhase cc_phase _stop hsc_env _basename _suff input_fn get_output_fn maybe_loc md_c_flags ++ pic_c_flags -#if defined(__PIC__) && defined(mingw32_HOST_OS) +#if defined(mingw32_TARGET_OS) -- Stub files generated for foreign exports references the runIO_closure -- and runNonIO_closure symbols, which are defined in the base package. -- These symbols are imported into the stub.c file via RtsAPI.h, and the -- 1.7.10.4