diff options
author | Ben Gamari <ben@smart-cactus.org> | 2018-11-26 17:21:12 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-11-27 14:25:03 -0500 |
commit | 730ac880c5dc23e0f32a2f08d89d4e5d2a583512 (patch) | |
tree | aa85ded8d0edd3d465963c8b3870b8270628ae30 | |
parent | df570d920fa66db631f936fa377e598fe92bd2a1 (diff) | |
download | haskell-730ac880c5dc23e0f32a2f08d89d4e5d2a583512.tar.gz |
Rip out object splittingwip/kill-obj-splitter
The splitter is an evil Perl script that processes assembler code.
Its job can be done better by the linker's --gc-sections flag. GHC
passes this flag to the linker whenever -split-sections is passed on
the command line.
This is based on @DemiMarie's D2768.
Fixes Trac #11315
Fixes Trac #9832
Fixes Trac #8964
Fixes Trac #8685
Fixes Trac #8629
59 files changed, 70 insertions, 887 deletions
diff --git a/.gitignore b/.gitignore index 59ca1ccc31..9c3d762873 100644 --- a/.gitignore +++ b/.gitignore @@ -68,7 +68,6 @@ _darcs/ /driver/ghc/dist/ /driver/haddock/dist/ /driver/ghci/dist/ -/driver/split/dist/ /includes/dist-*/ /libffi/dist-install/ /libraries/*/dist-boot/ diff --git a/aclocal.m4 b/aclocal.m4 index 447fd6119f..98cc8c3ed6 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -476,7 +476,6 @@ AC_DEFUN([FP_SETTINGS], SettingsLdCommand="\$tooldir/${mingw_bin_prefix}ld.exe" SettingsArCommand="\$tooldir/${mingw_bin_prefix}ar.exe" SettingsRanlibCommand="\$tooldir/${mingw_bin_prefix}ranlib.exe" - SettingsPerlCommand='$tooldir/perl/perl.exe' SettingsDllWrapCommand="\$tooldir/${mingw_bin_prefix}dllwrap.exe" SettingsWindresCommand="\$tooldir/${mingw_bin_prefix}windres.exe" SettingsTouchCommand='$topdir/bin/touchy.exe' @@ -488,7 +487,6 @@ AC_DEFUN([FP_SETTINGS], SettingsHaskellCPPFlags="$HaskellCPPArgs" SettingsLdCommand="$(basename $LdCmd)" SettingsArCommand="$(basename $ArCmd)" - SettingsPerlCommand="$(basename $PerlCmd)" SettingsDllWrapCommand="$(basename $DllWrapCmd)" SettingsWindresCommand="$(basename $WindresCmd)" SettingsTouchCommand='$topdir/bin/touchy.exe' @@ -499,7 +497,6 @@ AC_DEFUN([FP_SETTINGS], SettingsLdCommand="$LdCmd" SettingsArCommand="$ArCmd" SettingsRanlibCommand="$RanlibCmd" - SettingsPerlCommand="$PerlCmd" if test -z "$DllWrapCmd" then SettingsDllWrapCommand="/bin/false" @@ -552,7 +549,6 @@ AC_DEFUN([FP_SETTINGS], AC_SUBST(SettingsLdFlags) AC_SUBST(SettingsArCommand) AC_SUBST(SettingsRanlibCommand) - AC_SUBST(SettingsPerlCommand) AC_SUBST(SettingsDllWrapCommand) AC_SUBST(SettingsWindresCommand) AC_SUBST(SettingsLibtoolCommand) @@ -1328,22 +1324,6 @@ AC_DEFUN([FP_GCC_SUPPORTS_NO_PIE], rm -f conftest.c conftest.o conftest ]) -dnl Small feature test for perl version. Assumes PerlCmd -dnl contains path to perl binary. -dnl -dnl (Perl versions prior to v5.6 does not contain the string "v5"; -dnl instead they display version strings such as "version 5.005".) -dnl -AC_DEFUN([FPTOOLS_CHECK_PERL_VERSION], -[$PerlCmd -v >conftest.out 2>&1 - if grep "v5" conftest.out >/dev/null 2>&1; then - : - else - AC_MSG_ERROR([your version of perl probably won't work, try upgrading it.]) - fi -rm -fr conftest* -]) - # FP_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, # [VALUE-IF-NOT-FOUND], [PATH], [REJECT]) diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index 40b4e70aa0..73ca36c848 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -39,7 +39,6 @@ module CLabel ( mkAsmTempEndLabel, mkAsmTempDieLabel, - mkSplitMarkerLabel, mkDirty_MUT_VAR_Label, mkUpdInfoLabel, mkBHUpdInfoLabel, @@ -486,7 +485,7 @@ mkBlockInfoTableLabel name c = IdLabel name c BlockInfoTable -- See Note [Proc-point local block entry-point]. -- Constructing Cmm Labels -mkDirty_MUT_VAR_Label, mkSplitMarkerLabel, mkUpdInfoLabel, +mkDirty_MUT_VAR_Label, mkUpdInfoLabel, mkBHUpdInfoLabel, mkIndStaticInfoLabel, mkMainCapabilityLabel, mkMAP_FROZEN_CLEAN_infoLabel, mkMAP_FROZEN_DIRTY_infoLabel, mkMAP_DIRTY_infoLabel, @@ -496,7 +495,6 @@ mkDirty_MUT_VAR_Label, mkSplitMarkerLabel, mkUpdInfoLabel, mkSMAP_FROZEN_CLEAN_infoLabel, mkSMAP_FROZEN_DIRTY_infoLabel, mkSMAP_DIRTY_infoLabel, mkBadAlignmentLabel :: CLabel mkDirty_MUT_VAR_Label = mkForeignLabel (fsLit "dirty_MUT_VAR") Nothing ForeignLabelInExternalPackage IsFunction -mkSplitMarkerLabel = CmmLabel rtsUnitId (fsLit "__stg_split_marker") CmmCode mkUpdInfoLabel = CmmLabel rtsUnitId (fsLit "stg_upd_frame") CmmInfo mkBHUpdInfoLabel = CmmLabel rtsUnitId (fsLit "stg_bh_upd_frame" ) CmmInfo mkIndStaticInfoLabel = CmmLabel rtsUnitId (fsLit "stg_IND_STATIC") CmmInfo diff --git a/compiler/codeGen/StgCmm.hs b/compiler/codeGen/StgCmm.hs index acd2aee5f4..bd488b87d6 100644 --- a/compiler/codeGen/StgCmm.hs +++ b/compiler/codeGen/StgCmm.hs @@ -121,17 +121,14 @@ variable. -} cgTopBinding :: DynFlags -> CgStgTopBinding -> FCode () cgTopBinding dflags (StgTopLifted (StgNonRec id rhs)) - = do { id' <- maybeExternaliseId dflags id - ; let (info, fcode) = cgTopRhs dflags NonRecursive id' rhs + = do { let (info, fcode) = cgTopRhs dflags NonRecursive id rhs ; fcode - ; addBindC info -- Add the *un-externalised* Id to the envt, - -- so we find it when we look up occurrences + ; addBindC info } cgTopBinding dflags (StgTopLifted (StgRec pairs)) = do { let (bndrs, rhss) = unzip pairs - ; bndrs' <- Prelude.mapM (maybeExternaliseId dflags) bndrs - ; let pairs' = zip bndrs' rhss + ; let pairs' = zip bndrs rhss r = unzipWith (cgTopRhs dflags Recursive) pairs' (infos, fcodes) = unzip r ; addBindsC infos @@ -139,8 +136,7 @@ cgTopBinding dflags (StgTopLifted (StgRec pairs)) } cgTopBinding dflags (StgTopStringLit id str) - = do { id' <- maybeExternaliseId dflags id - ; let label = mkBytesLabel (idName id') + = do { let label = mkBytesLabel (idName id) ; let (lit, decl) = mkByteStringCLit label (BS.unpack str) ; emitDecl decl ; addBindC (litIdInfo dflags id' mkLFStringLit lit) @@ -148,7 +144,6 @@ cgTopBinding dflags (StgTopStringLit id str) cgTopRhs :: DynFlags -> RecFlag -> Id -> CgStgRhs -> (CgIdInfo, FCode ()) -- The Id is passed along for setting up a binding... - -- It's already been externalised if necessary cgTopRhs dflags _rec bndr (StgRhsCon _cc con args) = cgTopRhsCon dflags bndr con (assertNonVoidStgArgs args) @@ -227,25 +222,3 @@ cgDataCon data_con } -- The case continuation code expects a tagged pointer } - ---------------------------------------------------------------- --- Stuff to support splitting ---------------------------------------------------------------- - -maybeExternaliseId :: DynFlags -> Id -> FCode Id -maybeExternaliseId dflags id - | gopt Opt_SplitObjs dflags, -- See Note [Externalise when splitting] - -- in StgCmmMonad - isInternalName name = do { mod <- getModuleName - ; return (setIdName id (externalise mod)) } - | otherwise = return id - where - externalise mod = mkExternalName uniq mod new_occ loc - name = idName id - uniq = nameUnique name - new_occ = mkLocalOcc uniq (nameOccName name) - loc = nameSrcSpan name - -- We want to conjure up a name that can't clash with any - -- existing name. So we generate - -- Mod_$L243foo - -- where 243 is the unique. diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs index ea64e456ce..ccaeb4a0f0 100644 --- a/compiler/codeGen/StgCmmExpr.hs +++ b/compiler/codeGen/StgCmmExpr.hs @@ -740,19 +740,14 @@ cgIdApp fun_id args = do dflags <- getDynFlags fun_info <- getCgIdInfo fun_id self_loop_info <- getSelfLoop - let cg_fun_id = cg_id fun_info - -- NB: use (cg_id fun_info) instead of fun_id, because - -- the former may be externalised for -split-objs. - -- See Note [Externalise when splitting] in StgCmmMonad - - fun_arg = StgVarArg cg_fun_id - fun_name = idName cg_fun_id + let fun_arg = StgVarArg fun_id + fun_name = idName fun_id fun = idInfoToAmode fun_info lf_info = cg_lf fun_info n_args = length args v_args = length $ filter (isVoidTy . stgArgType) args node_points dflags = nodeMustPointToIt dflags lf_info - case getCallMethod dflags fun_name cg_fun_id lf_info n_args v_args (cg_loc fun_info) self_loop_info of + case getCallMethod dflags fun_name fun_id lf_info n_args v_args (cg_loc fun_info) self_loop_info of -- A value in WHNF, so we can just return it. ReturnIt | isVoidTy (idType fun_id) -> emitReturn [] diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs index 9ddd8a3985..b93e0ab6eb 100644 --- a/compiler/codeGen/StgCmmMonad.hs +++ b/compiler/codeGen/StgCmmMonad.hs @@ -174,20 +174,10 @@ type CgBindings = IdEnv CgIdInfo data CgIdInfo = CgIdInfo { cg_id :: Id -- Id that this is the info for - -- Can differ from the Id at occurrence sites by - -- virtue of being externalised, for splittable C - -- See Note [Externalise when splitting] , cg_lf :: LambdaFormInfo , cg_loc :: CgLoc -- CmmExpr for the *tagged* value } --- Note [Externalise when splitting] --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- If we're splitting the object with -fsplit-objs, we need to --- externalise *all* the top-level names, and then make sure we only --- use the externalised one in any C label we use which refers to this --- name. - instance Outputable CgIdInfo where ppr (CgIdInfo { cg_id = id, cg_loc = loc }) = ppr id <+> text "-->" <+> ppr loc diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 8a4cc4317d..67483230a6 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -92,8 +92,6 @@ else ifeq "$(INTEGER_LIBRARY)" "integer-simple" else ifneq "$(CLEANING)" "YES" $(error Unknown integer library) endif - @echo 'cSupportsSplitObjs :: String' >> $@ - @echo 'cSupportsSplitObjs = "$(SupportsSplitObjs)"' >> $@ @echo 'cGhcWithInterpreter :: String' >> $@ @echo 'cGhcWithInterpreter = "$(GhcWithInterpreter)"' >> $@ @echo 'cGhcWithNativeCodeGen :: String' >> $@ @@ -114,8 +112,6 @@ endif @echo 'cLeadingUnderscore = "$(LeadingUnderscore)"' >> $@ @echo 'cGHC_UNLIT_PGM :: String' >> $@ @echo 'cGHC_UNLIT_PGM = "$(utils/unlit_dist_PROG)"' >> $@ - @echo 'cGHC_SPLIT_PGM :: String' >> $@ - @echo 'cGHC_SPLIT_PGM = "$(driver/split_dist_PROG)"' >> $@ @echo 'cLibFFI :: Bool' >> $@ ifeq "$(UseLibFFIForAdjustors)" "YES" @echo 'cLibFFI = True' >> $@ @@ -421,9 +417,6 @@ compiler_PACKAGE = ghc # Don't do splitting for the GHC package, it takes too long and # there's not much benefit. -compiler_stage1_SplitObjs = NO -compiler_stage2_SplitObjs = NO -compiler_stage3_SplitObjs = NO compiler_stage1_SplitSections = NO compiler_stage2_SplitSections = NO compiler_stage3_SplitSections = NO diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs index d923262987..12e12ca321 100644 --- a/compiler/main/DriverPhases.hs +++ b/compiler/main/DriverPhases.hs @@ -138,8 +138,6 @@ data Phase | Cobjc -- Compile Objective-C | Cobjcxx -- Compile Objective-C++ | HCc -- Haskellised C (as opposed to vanilla C) compilation - | Splitter -- Assembly file splitter (part of '-split-objs') - | SplitAs -- Assembler for split assembly files (part of '-split-objs') | As Bool -- Assembler for regular assembly files (Bool: with-cpp) | LlvmOpt -- Run LLVM opt tool over llvm assembly | LlvmLlc -- LLVM bitcode to native assembly @@ -173,8 +171,6 @@ eqPhase (Hsc _) (Hsc _) = True eqPhase Cc Cc = True eqPhase Cobjc Cobjc = True eqPhase HCc HCc = True -eqPhase Splitter Splitter = True -eqPhase SplitAs SplitAs = True eqPhase (As x) (As y) = x == y eqPhase LlvmOpt LlvmOpt = True eqPhase LlvmLlc LlvmLlc = True @@ -218,11 +214,9 @@ nextPhase dflags p Cpp sf -> HsPp sf HsPp sf -> Hsc sf Hsc _ -> maybeHCc - Splitter -> SplitAs LlvmOpt -> LlvmLlc LlvmLlc -> LlvmMangle LlvmMangle -> As False - SplitAs -> MergeForeign As _ -> MergeForeign Ccxx -> As False Cc -> As False @@ -257,7 +251,6 @@ startPhase "M" = Cobjcxx startPhase "mm" = Cobjcxx startPhase "cc" = Ccxx startPhase "cxx" = Ccxx -startPhase "split_s" = Splitter startPhase "s" = As False startPhase "S" = As True startPhase "ll" = LlvmOpt @@ -286,13 +279,11 @@ phaseInputExt Ccxx = "cpp" phaseInputExt Cobjc = "m" phaseInputExt Cobjcxx = "mm" phaseInputExt Cc = "c" -phaseInputExt Splitter = "split_s" phaseInputExt (As True) = "S" phaseInputExt (As False) = "s" phaseInputExt LlvmOpt = "ll" phaseInputExt LlvmLlc = "bc" phaseInputExt LlvmMangle = "lm_s" -phaseInputExt SplitAs = "split_s" phaseInputExt CmmCpp = "cmmcpp" phaseInputExt Cmm = "cmm" phaseInputExt MergeForeign = "o" diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index a9e486c94a..6810de2e6b 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NamedFieldPuns, NondecreasingIndentation, BangPatterns #-} +{-# LANGUAGE CPP, NamedFieldPuns, NondecreasingIndentation, BangPatterns, MultiWayIf #-} {-# OPTIONS_GHC -fno-cse #-} -- -fno-cse is needed for GLOBAL_VAR's to behave properly @@ -245,7 +245,7 @@ compileOne' m_tc_result mHscMessage src_flavour = ms_hsc_src summary mod_name = ms_mod_name summary - next_phase = hscPostBackendPhase dflags src_flavour hsc_lang + next_phase = hscPostBackendPhase src_flavour hsc_lang object_filename = ml_obj_file location -- #8180 - when using TemplateHaskell, switch on -dynamic-too so @@ -502,7 +502,6 @@ compileFile hsc_env stop_phase (src, mb_phase) = do let dflags = hsc_dflags hsc_env - split = gopt Opt_SplitObjs dflags mb_o_file = outputFile dflags ghc_link = ghcLink dflags -- Set by -c or -no-link @@ -519,11 +518,7 @@ compileFile hsc_env stop_phase (src, mb_phase) = do -- -o foo applies to the file we are compiling now | otherwise = Persistent - stop_phase' = case stop_phase of - As _ | split -> SplitAs - _ -> stop_phase - - ( _, out_file) <- runPipeline stop_phase' hsc_env + ( _, out_file) <- runPipeline stop_phase hsc_env (src, fmap RealPhase mb_phase) Nothing output Nothing{-no ModLocation-} [] return out_file @@ -1079,7 +1074,7 @@ runPhase (HscOut src_flavour mod_name result) _ dflags = do let o_file = ml_obj_file location -- The real object file hsc_lang = hscTarget dflags - next_phase = hscPostBackendPhase dflags src_flavour hsc_lang + next_phase = hscPostBackendPhase src_flavour hsc_lang case result of HscNotGeneratingCode -> @@ -1132,7 +1127,7 @@ runPhase (RealPhase Cmm) input_fn dflags = do let hsc_lang = hscTarget dflags - let next_phase = hscPostBackendPhase dflags HsSrcFile hsc_lang + let next_phase = hscPostBackendPhase HsSrcFile hsc_lang output_fn <- phaseOutputFilename next_phase @@ -1275,40 +1270,9 @@ runPhase (RealPhase cc_phase) input_fn dflags return (RealPhase next_phase, output_fn) ----------------------------------------------------------------------------- --- Splitting phase - -runPhase (RealPhase Splitter) input_fn dflags - = do -- tmp_pfx is the prefix used for the split .s files - - split_s_prefix <- - liftIO $ newTempName dflags TFL_CurrentModule "split" - let n_files_fn = split_s_prefix - - liftIO $ SysTools.runSplit dflags - [ SysTools.FileOption "" input_fn - , SysTools.FileOption "" split_s_prefix - , SysTools.FileOption "" n_files_fn - ] - - -- Save the number of split files for future references - s <- liftIO $ readFile n_files_fn - let n_files = read s :: Int - dflags' = dflags { splitInfo = Just (split_s_prefix, n_files) } - - setDynFlags dflags' - - -- Remember to delete all these files - liftIO $ addFilesToClean dflags' TFL_CurrentModule $ - [ split_s_prefix ++ "__" ++ show n ++ ".s" - | n <- [1..n_files]] - - return (RealPhase SplitAs, - "**splitter**") -- we don't use the filename in SplitAs - ------------------------------------------------------------------------------ -- As, SpitAs phase : Assembler --- This is for calling the assembler on a regular assembly file (not split). +-- This is for calling the assembler on a regular assembly file runPhase (RealPhase (As with_cpp)) input_fn dflags = do -- LLVM from version 3.0 onwards doesn't support the OS X system @@ -1368,96 +1332,6 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags return (RealPhase next_phase, output_fn) --- This is for calling the assembler on a split assembly file (so a collection --- of assembly files) -runPhase (RealPhase SplitAs) _input_fn dflags - = do - -- we'll handle the stub_o file in this phase, so don't MergeForeign, - -- just jump straight to StopLn afterwards. - let next_phase = StopLn - output_fn <- phaseOutputFilename next_phase - - let base_o = dropExtension output_fn - osuf = objectSuf dflags - split_odir = base_o ++ "_" ++ osuf ++ "_split" - - let pic_c_flags = picCCOpts dflags - - -- this also creates the hierarchy - liftIO $ createDirectoryIfMissing True split_odir - - -- remove M_split/ *.o, because we're going to archive M_split/ *.o - -- later and we don't want to pick up any old objects. - fs <- liftIO $ getDirectoryContents split_odir - liftIO $ mapM_ removeFile $ - map (split_odir </>) $ filter (osuf `isSuffixOf`) fs - - let (split_s_prefix, n) = case splitInfo dflags of - Nothing -> panic "No split info" - Just x -> x - - let split_s n = split_s_prefix ++ "__" ++ show n <.> "s" - - split_obj :: Int -> FilePath - split_obj n = split_odir </> - takeFileName base_o ++ "__" ++ show n <.> osuf - - let assemble_file n - = SysTools.runAs dflags ( - - -- We only support SparcV9 and better because V8 lacks an atomic CAS - -- instruction so we have to make sure that the assembler accepts the - -- instruction set. Note that the user can still override this - -- (e.g., -mcpu=ultrasparc). GCC picks the "best" -mcpu flag - -- regardless of the ordering. - -- - -- This is a temporary hack. - (if platformArch (targetPlatform dflags) == ArchSPARC - then [SysTools.Option "-mcpu=v9"] - else []) ++ - - -- See Note [-fPIC for assembler] - map SysTools.Option pic_c_flags ++ - - [ SysTools.Option "-c" - , SysTools.Option "-o" - , SysTools.FileOption "" (split_obj n) - , SysTools.FileOption "" (split_s n) - ]) - - liftIO $ mapM_ assemble_file [1..n] - - -- Note [pipeline-split-init] - -- If we have a stub file -- which will be part of foreign_os -- - -- it may contain constructor - -- functions for initialisation of this module. We can't - -- simply leave the stub as a separate object file, because it - -- will never be linked in: nothing refers to it. We need to - -- ensure that if we ever refer to the data in this module - -- that needs initialisation, then we also pull in the - -- initialisation routine. - -- - -- To that end, we make a DANGEROUS ASSUMPTION here: the data - -- that needs to be initialised is all in the FIRST split - -- object. See Note [codegen-split-init]. - -- - -- We also merge in all the foreign objects since we're at it. - - PipeState{foreign_os} <- getPipeState - if null foreign_os - then return () - else liftIO $ do - tmp_split_1 <- newTempName dflags TFL_CurrentModule osuf - let split_1 = split_obj 1 - copyFile split_1 tmp_split_1 - removeFile split_1 - joinObjectFiles dflags (tmp_split_1 : foreign_os) split_1 - - -- join them into a single .o file - liftIO $ joinObjectFiles dflags (map split_obj [1..n]) output_fn - - return (RealPhase next_phase, output_fn) - ----------------------------------------------------------------------------- -- LlvmOpt phase runPhase (RealPhase LlvmOpt) input_fn dflags @@ -1499,13 +1373,10 @@ runPhase (RealPhase LlvmOpt) input_fn dflags runPhase (RealPhase LlvmLlc) input_fn dflags = do - next_phase <- if fastLlvmPipeline dflags - then maybeMergeForeign - -- hidden debugging flag '-dno-llvm-mangler' to skip mangling - else case gopt Opt_NoLlvmMangler dflags of - False -> return LlvmMangle - True | gopt Opt_SplitObjs dflags -> return Splitter - True -> return (As False) + next_phase <- if | fastLlvmPipeline dflags -> maybeMergeForeign + -- hidden debugging flag '-dno-llvm-mangler' to skip mangling + | gopt Opt_NoLlvmMangler dflags -> return (As False) + | otherwise -> return LlvmMangle output_fn <- phaseOutputFilename next_phase @@ -1577,7 +1448,7 @@ runPhase (RealPhase LlvmLlc) input_fn dflags runPhase (RealPhase LlvmMangle) input_fn dflags = do - let next_phase = if gopt Opt_SplitObjs dflags then Splitter else As False + let next_phase = As False output_fn <- phaseOutputFilename next_phase liftIO $ llvmFixupAsm dflags input_fn output_fn return (RealPhase next_phase, output_fn) @@ -2216,14 +2087,13 @@ writeInterfaceOnlyMode dflags = HscNothing == hscTarget dflags -- | What phase to run after one of the backend code generators has run -hscPostBackendPhase :: DynFlags -> HscSource -> HscTarget -> Phase -hscPostBackendPhase _ HsBootFile _ = StopLn -hscPostBackendPhase _ HsigFile _ = StopLn -hscPostBackendPhase dflags _ hsc_lang = +hscPostBackendPhase :: HscSource -> HscTarget -> Phase +hscPostBackendPhase HsBootFile _ = StopLn +hscPostBackendPhase HsigFile _ = StopLn +hscPostBackendPhase _ hsc_lang = case hsc_lang of - HscC -> HCc - HscAsm | gopt Opt_SplitObjs dflags -> Splitter - | otherwise -> As False + HscC -> HCc + HscAsm -> As False HscLlvm -> LlvmOpt HscNothing -> StopLn HscInterpreted -> StopLn diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index b574ba9080..1702bce392 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -88,7 +88,7 @@ module DynFlags ( ghcUsagePath, ghciUsagePath, topDir, tmpDir, rawSettings, versionedAppDir, extraGccViaCFlags, systemPackageConfig, - pgm_L, pgm_P, pgm_F, pgm_c, pgm_s, pgm_a, pgm_l, pgm_dll, pgm_T, + pgm_L, pgm_P, pgm_F, pgm_c, pgm_a, pgm_l, pgm_dll, pgm_T, pgm_windres, pgm_libtool, pgm_ar, pgm_ranlib, pgm_lo, pgm_lc, pgm_lcc, pgm_i, opt_L, opt_P, opt_F, opt_c, opt_a, opt_l, opt_i, opt_P_signature, @@ -523,7 +523,6 @@ data GeneralFlag | Opt_ExcessPrecision | Opt_EagerBlackHoling | Opt_NoHsMain - | Opt_SplitObjs | Opt_SplitSections | Opt_StgStats | Opt_HideAllPackages @@ -1720,13 +1719,10 @@ wayUnsetGeneralFlags :: Platform -> Way -> [GeneralFlag] wayUnsetGeneralFlags _ (WayCustom {}) = [] wayUnsetGeneralFlags _ WayThreaded = [] wayUnsetGeneralFlags _ WayDebug = [] -wayUnsetGeneralFlags _ WayDyn = [-- There's no point splitting objects +wayUnsetGeneralFlags _ WayDyn = [-- There's no point splitting -- when we're going to be dynamically -- linking. Plus it breaks compilation -- on OSX x86. - Opt_SplitObjs, - -- If splitobjs wasn't useful for this, - -- assume sections aren't either. Opt_SplitSections] wayUnsetGeneralFlags _ WayProf = [] wayUnsetGeneralFlags _ WayEventLog = [] @@ -2954,7 +2950,7 @@ dynamic_flags_deps = [ -- (see Trac #15319) sGccSupportsNoPie = False}))) , make_ord_flag defFlag "pgms" - (hasArg (\f -> alterSettings (\s -> s { sPgm_s = (f,[])}))) + (HasArg (\f -> addWarn "Object splitting was removed in GHC 8.8")) , make_ord_flag defFlag "pgma" (hasArg (\f -> alterSettings (\s -> s { sPgm_a = (f,[])}))) , make_ord_flag defFlag "pgml" @@ -2995,9 +2991,7 @@ dynamic_flags_deps = [ alterSettings (\s -> s { sOpt_windres = f : sOpt_windres s}))) , make_ord_flag defGhcFlag "split-objs" - (NoArg (if can_split - then setGeneralFlag Opt_SplitObjs - else addWarn "ignoring -split-objs")) + (NoArg $ addWarn "ignoring -split-objs") , make_ord_flag defGhcFlag "split-sections" (noArgM (\dflags -> do @@ -5499,12 +5493,6 @@ picPOpts dflags | otherwise = [] -- ----------------------------------------------------------------------------- --- Splitting - -can_split :: Bool -can_split = cSupportsSplitObjs == "YES" - --- ----------------------------------------------------------------------------- -- Compiler Info compilerInfo :: DynFlags -> [(String, String)] @@ -5526,7 +5514,7 @@ compilerInfo dflags ("Host platform", cHostPlatformString), ("Target platform", cTargetPlatformString), ("Have interpreter", cGhcWithInterpreter), - ("Object splitting supported", cSupportsSplitObjs), + ("Object splitting supported", showBool False), ("Have native code generator", cGhcWithNativeCodeGen), ("Support SMP", cGhcWithSMP), ("Tables next to code", cGhcEnableTablesNextToCode), diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index d7cebd00fc..49016e3799 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -1451,7 +1451,7 @@ doCodeGen hsc_env this_mod data_tycons -- we generate one SRT for the whole module. let pipeline_stream - | gopt Opt_SplitObjs dflags || gopt Opt_SplitSections dflags || + | gopt Opt_SplitSections dflags || osSubsectionsViaSymbols (platformOS (targetPlatform dflags)) = {-# SCC "cmmPipeline" #-} let run_pipeline us cmmgroup = do diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 9bbce19602..543dd9ce3b 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -139,7 +139,7 @@ initSysTools top_dir -- NB: top_dir is assumed to be in standard Unix -- format, '/' separated mtool_dir <- findToolDir top_dir - -- see Note [tooldir: How GHC finds mingw and perl on Windows] + -- see Note [tooldir: How GHC finds mingw on Windows] let installed :: FilePath -> FilePath installed file = top_dir </> file @@ -212,7 +212,6 @@ initSysTools top_dir ldSupportsBuildId <- getBooleanSetting "ld supports build-id" ldSupportsFilelist <- getBooleanSetting "ld supports filelist" ldIsGnuLd <- getBooleanSetting "ld is GNU ld" - perl_path <- getToolSetting "perl command" let pkgconfig_path = installed "package.conf.d" ghc_usage_msg_path = installed "ghc-usage.txt" @@ -222,9 +221,6 @@ initSysTools top_dir -- architecture-specific stuff is done when building Config.hs unlit_path = libexec cGHC_UNLIT_PGM - -- split is a Perl script - split_script = libexec cGHC_SPLIT_PGM - windres_path <- getToolSetting "windres command" libtool_path <- getToolSetting "libtool command" ar_path <- getToolSetting "ar command" @@ -234,15 +230,6 @@ initSysTools top_dir touch_path <- getToolSetting "touch command" - let -- On Win32 we don't want to rely on #!/bin/perl, so we prepend - -- a call to Perl to get the invocation of split. - -- On Unix, scripts are invoked using the '#!' method. Binary - -- installations of GHC on Unix place the correct line on the - -- front of the script at installation time, so we don't want - -- to wire-in our knowledge of $(PERL) on the host system here. - (split_prog, split_args) - | isWindowsHost = (perl_path, [Option split_script]) - | otherwise = (split_script, []) mkdll_prog <- getToolSetting "dllwrap command" let mkdll_args = [] @@ -297,7 +284,6 @@ initSysTools top_dir sPgm_P = (cpp_prog, cpp_args), sPgm_F = "", sPgm_c = (gcc_prog, gcc_args), - sPgm_s = (split_prog,split_args), sPgm_a = (as_prog, as_args), sPgm_l = (ld_prog, ld_args), sPgm_dll = (mkdll_prog,mkdll_args), diff --git a/compiler/main/SysTools/BaseDir.hs b/compiler/main/SysTools/BaseDir.hs index 786b0e4ee9..d01d5214b4 100644 --- a/compiler/main/SysTools/BaseDir.hs +++ b/compiler/main/SysTools/BaseDir.hs @@ -68,7 +68,7 @@ On Windows: from topdir we can find package.conf, ghc-asm, etc. -Note [tooldir: How GHC finds mingw and perl on Windows] +Note [tooldir: How GHC finds mingw on Windows] GHC has some custom logic on Windows for finding the mingw toolchain and perl. Depending on whether GHC is built diff --git a/compiler/main/SysTools/Tasks.hs b/compiler/main/SysTools/Tasks.hs index a986db2fc0..9e3df26877 100644 --- a/compiler/main/SysTools/Tasks.hs +++ b/compiler/main/SysTools/Tasks.hs @@ -131,11 +131,6 @@ askLd dflags args = do runSomethingWith dflags "gcc" p args2 $ \real_args -> readCreateProcessWithExitCode' (proc p real_args){ env = mb_env } -runSplit :: DynFlags -> [Option] -> IO () -runSplit dflags args = do - let (p,args0) = pgm_s dflags - runSomething dflags "Splitter" p (args0++args) - runAs :: DynFlags -> [Option] -> IO () runAs dflags args = do let (p,args0) = pgm_a dflags diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs index 956528bf81..07cc112ef9 100644 --- a/compiler/nativeGen/AsmCodeGen.hs +++ b/compiler/nativeGen/AsmCodeGen.hs @@ -335,7 +335,7 @@ finishNativeGen :: Instruction instr finishNativeGen dflags modLoc bufh@(BufHandle _ _ h) us ngs = do -- Write debug data and finish - let emitDw = debugLevel dflags > 0 && not (gopt Opt_SplitObjs dflags) + let emitDw = debugLevel dflags > 0 us' <- if not emitDw then return us else do (dwarf, us') <- dwarfGen dflags modLoc us (ngs_debug ngs) emitNativeCode dflags bufh dwarf @@ -406,14 +406,9 @@ cmmNativeGenStream dflags this_mod modLoc ncgImpl h us cmm_stream ngs | otherwise = [] dbgMap = debugToMap ndbgs - -- Insert split marker, generate native code - let splitObjs = gopt Opt_SplitObjs dflags - split_marker = CmmProc mapEmpty mkSplitMarkerLabel [] $ - ofBlockList (panic "split_marker_entry") [] - cmms' | splitObjs = split_marker : cmms - | otherwise = cmms + -- Generate native code (ngs',us') <- cmmNativeGens dflags this_mod modLoc ncgImpl h - dbgMap us cmms' ngs 0 + dbgMap us cmms ngs 0 -- Link native code information into debug blocks -- See Note [What is this unwinding business?] in Debug. @@ -421,23 +416,10 @@ cmmNativeGenStream dflags this_mod modLoc ncgImpl h us cmm_stream ngs dumpIfSet_dyn dflags Opt_D_dump_debug "Debug Infos" (vcat $ map ppr ldbgs) - -- Emit & clear DWARF information when generating split - -- object files, as we need it to land in the same object file - -- When using split sections, note that we do not split the debug - -- info but emit all the info at once in finishNativeGen. - (ngs'', us'') <- - if debugFlag && splitObjs - then do (dwarf, us'') <- dwarfGen dflags modLoc us ldbgs - emitNativeCode dflags h dwarf - return (ngs' { ngs_debug = [] - , ngs_dwarfFiles = emptyUFM - , ngs_labels = [] }, - us'') - else return (ngs' { ngs_debug = ngs_debug ngs' ++ ldbgs - , ngs_labels = [] }, - us') - - cmmNativeGenStream dflags this_mod modLoc ncgImpl h us'' + -- Accumulate debug information for emission in finishNativeGen. + let ngs'' = ngs' { ngs_debug = ngs_debug ngs' ++ ldbgs, ngs_labels = [] } + + cmmNativeGenStream dflags this_mod modLoc ncgImpl h us' cmm_stream' ngs'' -- | Do native code generation on all these cmms. diff --git a/compiler/nativeGen/CFG.hs b/compiler/nativeGen/CFG.hs index 820785995e..7243d6a7ed 100644 --- a/compiler/nativeGen/CFG.hs +++ b/compiler/nativeGen/CFG.hs @@ -482,12 +482,7 @@ addNodesBetween m updates = -- | Generate weights for a Cmm proc based on some simple heuristics. getCfgProc :: D.CfgWeights -> RawCmmDecl -> CFG getCfgProc _ (CmmData {}) = mapEmpty --- Sometimes GHC generates dummy procs which don't actually contain code. --- But they might contain bottoms in some fields so we check for an empty --- body first. In particular this happens with SplitObjs enabled. -getCfgProc weights (CmmProc _info _lab _live graph) - | null (toBlockList graph) = mapEmpty - | otherwise = getCfg weights graph +getCfgProc weights (CmmProc _info _lab _live graph) = getCfg weights graph getCfg :: D.CfgWeights -> CmmGraph -> CFG diff --git a/compiler/nativeGen/PIC.hs b/compiler/nativeGen/PIC.hs index 2f300c4614..d46dbe10e5 100644 --- a/compiler/nativeGen/PIC.hs +++ b/compiler/nativeGen/PIC.hs @@ -565,8 +565,6 @@ pprGotDeclaration _ _ _ -- For each processor architecture, there are two versions, one for PIC -- and one for non-PIC. -- --- Whenever you change something in this assembler output, make sure --- the splitter in driver/split/ghc-split.pl recognizes the new output pprImportedSymbol :: DynFlags -> Platform -> CLabel -> SDoc pprImportedSymbol dflags platform@(Platform { platformArch = ArchPPC, platformOS = OSDarwin }) importedLbl diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs index 3d9077df19..648e71b31f 100644 --- a/compiler/nativeGen/PPC/Ppr.hs +++ b/compiler/nativeGen/PPC/Ppr.hs @@ -49,17 +49,14 @@ pprNatCmmDecl proc@(CmmProc top_info lbl _ (ListGraph blocks)) = case topInfoTable proc of Nothing -> sdocWithPlatform $ \platform -> - case blocks of - [] -> -- special case for split markers: - pprLabel lbl - blocks -> -- special case for code without info table: - pprSectionAlign (Section Text lbl) $$ - (case platformArch platform of - ArchPPC_64 ELF_V1 -> pprFunctionDescriptor lbl - ArchPPC_64 ELF_V2 -> pprFunctionPrologue lbl - _ -> pprLabel lbl) $$ -- blocks guaranteed not null, + -- special case for code without info table: + pprSectionAlign (Section Text lbl) $$ + (case platformArch platform of + ArchPPC_64 ELF_V1 -> pprFunctionDescriptor lbl + ArchPPC_64 ELF_V2 -> pprFunctionPrologue lbl + _ -> pprLabel lbl) $$ -- blocks guaranteed not null, -- so label needed - vcat (map (pprBasicBlock top_info) blocks) + vcat (map (pprBasicBlock top_info) blocks) Just (Statics info_lbl _) -> sdocWithPlatform $ \platform -> diff --git a/compiler/nativeGen/RegAlloc/Liveness.hs b/compiler/nativeGen/RegAlloc/Liveness.hs index b7f8d1c871..b7dbc51961 100644 --- a/compiler/nativeGen/RegAlloc/Liveness.hs +++ b/compiler/nativeGen/RegAlloc/Liveness.hs @@ -504,10 +504,6 @@ stripLive dflags live in CmmProc info label live (ListGraph $ map (stripLiveBlock dflags) $ first' : rest') - -- procs used for stg_split_markers don't contain any blocks, and have no first_id. - stripCmm (CmmProc (LiveInfo info [] _ _) label live []) - = CmmProc info label live (ListGraph []) - -- If the proc has blocks but we don't know what the first one was, then we're dead. stripCmm proc = pprPanic "RegAlloc.Liveness.stripLive: no first_id on proc" (ppr proc) diff --git a/compiler/nativeGen/SPARC/Ppr.hs b/compiler/nativeGen/SPARC/Ppr.hs index b4cdbda369..31994c3c14 100644 --- a/compiler/nativeGen/SPARC/Ppr.hs +++ b/compiler/nativeGen/SPARC/Ppr.hs @@ -61,13 +61,10 @@ pprNatCmmDecl (CmmData section dats) = pprNatCmmDecl proc@(CmmProc top_info lbl _ (ListGraph blocks)) = case topInfoTable proc of Nothing -> - case blocks of - [] -> -- special case for split markers: - pprLabel lbl - blocks -> -- special case for code without info table: - pprSectionAlign (Section Text lbl) $$ - pprLabel lbl $$ -- blocks guaranteed not null, so label needed - vcat (map (pprBasicBlock top_info) blocks) + -- special case for code without info table: + pprSectionAlign (Section Text lbl) $$ + pprLabel lbl $$ -- blocks guaranteed not null, so label needed + vcat (map (pprBasicBlock top_info) blocks) Just (Statics info_lbl _) -> sdocWithPlatform $ \platform -> diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index 141e781cc6..ca19994fb3 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -86,17 +86,14 @@ pprNatCmmDecl proc@(CmmProc top_info lbl _ (ListGraph blocks)) = pprProcAlignment $$ case topInfoTable proc of Nothing -> - case blocks of - [] -> -- special case for split markers: - pprLabel lbl - blocks -> -- special case for code without info table: - pprSectionAlign (Section Text lbl) $$ - pprProcAlignment $$ - pprLabel lbl $$ -- blocks guaranteed not null, so label needed - vcat (map (pprBasicBlock top_info) blocks) $$ - (if debugLevel dflags > 0 - then ppr (mkAsmTempEndLabel lbl) <> char ':' else empty) $$ - pprSizeDecl lbl + -- special case for code without info table: + pprSectionAlign (Section Text lbl) $$ + pprProcAlignment $$ + pprLabel lbl $$ -- blocks guaranteed not null, so label needed + vcat (map (pprBasicBlock top_info) blocks) $$ + (if debugLevel dflags > 0 + then ppr (mkAsmTempEndLabel lbl) <> char ':' else empty) $$ + pprSizeDecl lbl Just (Statics info_lbl _) -> sdocWithPlatform $ \platform -> diff --git a/configure.ac b/configure.ac index 5ae1c6a0f4..94a3a646c9 100644 --- a/configure.ac +++ b/configure.ac @@ -388,20 +388,6 @@ then fp_prog_ar="${mingwbin}ar.exe" AC_PATH_PROG([Genlib],[genlib]) - - # NB. Download the perl binaries if required - if ! test -d inplace/perl || - test inplace/perl -ot ghc-tarballs/perl/ghc-perl*.tar.gz - then - AC_MSG_NOTICE([Making in-tree perl tree]) - rm -rf inplace/perl - mkdir inplace/perl - ( - cd inplace/perl && - tar -zxf ../../ghc-tarballs/perl/ghc-perl*.tar.gz - ) - AC_MSG_NOTICE([In-tree perl tree created]) - fi fi # We don't want to bundle a MinGW-w64 toolchain @@ -695,36 +681,6 @@ AC_SUBST([GhcLibsWithUnix]) dnl ** does #! work? AC_SYS_INTERPRETER() -# Check for split-objs -SplitObjsBroken=NO -dnl ** look for `perl' -case $HostOS_CPP in -cygwin32|mingw32) - if test "$EnableDistroToolchain" = "NO"; then - PerlCmd=$hardtop/inplace/perl/perl - else - AC_PATH_PROG([PerlCmd],[perl]) - fi - # because of Trac #15051 SplitObjs is useless on Windows. It regresses - # build times to days for a build, and this effect is also there for end users - # of GHC. So unfortunately we have to disable it, even without having - # split-sections. Though the compile time hit for split-sections should be - # tiny compared to this so maybe we should enable it for x86_64. - SplitObjsBroken=YES - ;; -*) - AC_PATH_PROG([PerlCmd],[perl]) - if test -z "$PerlCmd" - then - AC_MSG_WARN([No Perl on PATH, disabling split object support]) - SplitObjsBroken=YES - else - FPTOOLS_CHECK_PERL_VERSION - fi - ;; -esac -AC_SUBST([SplitObjsBroken]) - dnl ** look for GCC and find out which version dnl Figure out which C compiler to use. Gcc is preferred. dnl If gcc, make sure it's at least 3.0 @@ -1390,7 +1346,6 @@ echo "\ genlib : $GenlibCmd Happy : $HappyCmd ($HappyVersion) Alex : $AlexCmd ($AlexVersion) - Perl : $PerlCmd sphinx-build : $SPHINXBUILD xelatex : $XELATEX diff --git a/distrib/cross-port b/distrib/cross-port index 7c54604ae6..4a1854135a 100644 --- a/distrib/cross-port +++ b/distrib/cross-port @@ -35,7 +35,6 @@ if [ ! -f b1-stamp ]; then echo "GhcUnregisterised = YES" >> mk/build.mk echo "GhcLibHcOpts = -O -H32m -fvia-C -keep-hc-files" >> mk/build.mk echo "GhcLibWays =" >> mk/build.mk - echo "SplitObjs = NO" >> mk/build.mk # We could optimise slightly by not building hslibs here. Also, building # the RTS is not necessary (and might not be desirable if we're using diff --git a/distrib/hc-build b/distrib/hc-build index 43133f83de..13afaa7adb 100644 --- a/distrib/hc-build +++ b/distrib/hc-build @@ -32,7 +32,6 @@ cat >>mk/build.mk <<END GhcUnregisterised=YES GhcWithInterpreter=NO GhcWithNativeCodeGen=NO -SplitObjs=NO GhcLibWays= GhcWithSMP=NO END diff --git a/docs/storage-mgt/rp.tex b/docs/storage-mgt/rp.tex index 2f83532893..199b284b19 100644 --- a/docs/storage-mgt/rp.tex +++ b/docs/storage-mgt/rp.tex @@ -173,7 +173,6 @@ Installing the GHC is done as follows: \begin{code} ./fptools/mk vi build.mk GhcHcOpts = -O -fasm -Rghc-timing - SplitObjs = NO GhcRtsHcOpts = GhcRtsCcOpts = -g STRIP_CMD =: diff --git a/docs/users_guide/8.8.1-notes.rst b/docs/users_guide/8.8.1-notes.rst index 69b9c5d536..5e854cb5d1 100644 --- a/docs/users_guide/8.8.1-notes.rst +++ b/docs/users_guide/8.8.1-notes.rst @@ -79,6 +79,11 @@ Compiler - The deprecated ghc-flag ``-Wamp`` has been removed. +- Support for object splitting with the flag ``-split-objs`` is removed. Using + this flag now results in a warning and does nothing. Use + :ghc-flag:`-split-sections` instead. + + Runtime system ~~~~~~~~~~~~~~ diff --git a/docs/users_guide/packages.rst b/docs/users_guide/packages.rst index 632162f6c8..9383b8ad68 100644 --- a/docs/users_guide/packages.rst +++ b/docs/users_guide/packages.rst @@ -1023,9 +1023,9 @@ extra indirection). ``HSfoo.o`` file that has been pre-linked. Loading the ``.o`` file is slightly quicker, but at the expense of having another copy of the compiled package. The rule of thumb is that if the modules of the - package were compiled with :ghc-flag:`-split-objs` then building the + package were compiled with :ghc-flag:`-split-sections` then building the ``HSfoo.o`` is worthwhile because it saves time when loading the - package into GHCi. Without :ghc-flag:`-split-objs`, there is not much + package into GHCi. Without :ghc-flag:`-split-sections`, there is not much difference in load time between the ``.o`` and ``.a`` libraries, so it is better to save the disk space and only keep the ``.a`` around. In a GHC distribution we provide ``.o`` files for most packages diff --git a/docs/users_guide/phases.rst b/docs/users_guide/phases.rst index f5f735b81b..0f70368047 100644 --- a/docs/users_guide/phases.rst +++ b/docs/users_guide/phases.rst @@ -732,21 +732,6 @@ for example). option for Apple's Linker (``-F`` already means something else for GHC). -.. ghc-flag:: -split-objs - :shortdesc: Split objects (for libraries) - :type: dynamic - :category: linking - - Tell the linker to split the single object file that would normally - be generated into multiple object files, one per top-level Haskell - function or type in the module. This only makes sense for libraries, - where it means that executables linked against the library are - smaller as they only link against the object files that they need. - However, assembling all the sections separately is expensive, so - this is slower than compiling normally. Additionally, the size of - the library itself (the ``.a`` file) can be a factor of 2 to 2.5 - larger. - .. ghc-flag:: -split-sections :shortdesc: Split sections for link-time dead-code stripping :type: dynamic @@ -758,9 +743,7 @@ for example). output file. When linking, the linker can automatically remove all unreferenced sections - and thus produce smaller executables. The effect is similar to - :ghc-flag:`-split-objs`, but somewhat more efficient - the generated library - files are about 30% smaller than with :ghc-flag:`-split-objs`. + and thus produce smaller executables. .. ghc-flag:: -static :shortdesc: Use static Haskell libraries diff --git a/driver/split/Makefile b/driver/split/Makefile deleted file mode 100644 index 93e9b127eb..0000000000 --- a/driver/split/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 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://ghc.haskell.org/trac/ghc/wiki/Building/Architecture -# http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying -# -# ----------------------------------------------------------------------------- - -dir = driver/split -TOP = ../.. -include $(TOP)/mk/sub-makefile.mk diff --git a/driver/split/ghc-split.pl b/driver/split/ghc-split.pl deleted file mode 100644 index 1b3a3ed47c..0000000000 --- a/driver/split/ghc-split.pl +++ /dev/null @@ -1,275 +0,0 @@ -#************************************************************************ -#* * -#* \section[Driver-obj-splitting]{Splitting into many \tr{.o} files (for libraries)} -#* * -#************************************************************************ - -$TargetPlatform = $TARGETPLATFORM; - -($Pgm = $0) =~ s|.*/||; -$ifile = $ARGV[0]; -$Tmp_prefix = $ARGV[1]; -$Output = $ARGV[2]; - -&split_asm_file($ifile); - -open(OUTPUT, '>', $Output) || &tidy_up_and_die(1,"$Pgm: failed to open `$Output' (to write)\n"); -print OUTPUT "$NoOfSplitFiles\n"; -close(OUTPUT); - -exit(0); - - -sub split_asm_file { - (my $asm_file,) = @_; - my @pieces = (); - - open(TMPI, '<', $asm_file) || &tidy_up_and_die(1,"$Pgm: failed to open `$asm_file' (to read)\n"); - - - $octr = 0; # output file counter - - %LocalConstant = (); # we have to subvert C compiler's commoning-up of constants... - - $s_stuff = &ReadTMPIUpToAMarker( '', $octr ); - # that first stuff is a prologue for all .s outputs - $prologue_stuff = &process_asm_block ( $s_stuff ); - # $_ already has some of the next stuff in it... - -# &tidy_up_and_die(1,"$Pgm: no split markers in .s file!\n") -# if $prologue_stuff eq $s_stuff; - - while ( $_ ne '' ) { # not EOF - $octr++; - - # grab and de-mangle a section of the .s file... - $s_stuff = &ReadTMPIUpToAMarker ( $_, $octr ); - $pieces[$octr] = &process_asm_block ( $s_stuff ); - } - - # Make sure that we still have some output when the input file is empty - if ($octr == 0) { - $octr = 1; - $pieces[$octr] = ''; - } - - $NoOfSplitFiles = $octr; - - if ($pieces[$NoOfSplitFiles] =~ /(\n[ \t]*\.section[ \t]+\.note\.GNU-stack,[^\n]*\n)/m) { - $note_gnu_stack = $1; - for $octr (1..($NoOfSplitFiles - 1)) { - $pieces[$octr] .= $note_gnu_stack; - } - } - - for $octr (1..$NoOfSplitFiles) { - # output to a file of its own - # open a new output file... - $ofname = "${Tmp_prefix}__${octr}.s"; - open(OUTF, '>', $ofname) || die "$Pgm: can't open output file: $ofname\n"; - - print OUTF $prologue_stuff; - print OUTF $pieces[$octr]; - - close(OUTF) - || &tidy_up_and_die(1,"$Pgm:Failed writing ${Tmp_prefix}__${octr}.s\n"); - } - - close(TMPI) || &tidy_up_and_die(1,"Failed reading $asm_file\n"); -} - -sub ReadTMPIUpToAMarker { - (my $str, my $count) = @_; # already read bits - - - for ( $_ = <TMPI>; $_ ne '' && ! /_?__stg_split_marker/m; $_ = <TMPI> ) { - $str .= $_; - } - # if not EOF, then creep forward until next "real" line - # (throwing everything away). - # that first "real" line will stay in $_. - - # This loop is intended to pick up the body of the split_marker function - - while ($_ ne '' && (/_?__stg_split_marker/m - || /^L[^C].*:$/m - || /\t\.frame/m - # || /\t\.end/ NOT! Let the split_marker regexp catch it - # || /\t\.ent/ NOT! Let the split_marker regexp catch it - || /^\s+(save|retl?|restore|nop)/m)) { - $_ = <TMPI>; - } - - print STDERR "### BLOCK:$count:\n$str" if $Dump_asm_splitting_info; - - # return str - $str =~ tr/\r//d if $TargetPlatform =~ /-mingw32$/m; # in case Perl doesn't convert line endings - $str; -} -=pod - -We must (a)~strip the marker off the block, (b)~record any literal C -constants that are defined here, and (c)~inject copies of any C constants -that are used-but-not-defined here. - -=cut - -sub process_asm_block { - local($str) = @_; - - return(&process_asm_block_sparc($str)) if $TargetPlatform =~ /^sparc-/m; - return(&process_asm_block_iX86($str)) if $TargetPlatform =~ /^i[34]86-/m; - return(&process_asm_block_x86_64($str)) if $TargetPlatform =~ /^x86_64-/m; - return(&process_asm_block_powerpc_linux($str)) - if $TargetPlatform =~ /^powerpc-[^-]+-linux/m; - - # otherwise... - &tidy_up_and_die(1,"$Pgm: no process_asm_block for $TargetPlatform\n"); -} - -sub process_asm_block_sparc { - local($str) = @_; - - # strip the marker - $str =~ s/(\.text\n\t\.align .\n)\t\.global\s+.*_?__stg_split_marker.*\n\t\.proc.*\n/$1/m; - $str =~ s/(\t\.align .\n)\t\.global\s+.*_?__stg_split_marker.*\n\t\.proc.*\n/$1/m; - - # remove/record any literal constants defined here - while ( $str =~ /(\t\.align .\n\.?(L?LC\d+):\n(\t\.asci[iz].*\n)+)/m ) { - local($label) = $2; - local($body) = $1; - - &tidy_up_and_die(1,"Local constant label $label already defined!\n") - if $LocalConstant{$label}; - - $LocalConstant{$label} = $body; - - $str =~ s/\t\.align .\n\.?LL?C\d+:\n(\t\.asci[iz].*\n)+//m; - } - - # inject definitions for any local constants now used herein - foreach $k (keys %LocalConstant) { - if ( $str =~ /\b$k\b/m ) { - $str = $LocalConstant{$k} . $str; - } - } - - print STDERR "### STRIPPED BLOCK (sparc):\n$str" if $Dump_asm_splitting_info; - - $str; -} - -sub process_asm_block_iX86 { - (my $str,) = @_; - - # strip the marker - - $str =~ s/(\.text\n\t\.align .(?:,0x90)?\n)\.globl\s+.*_?__stg_split_marker.*\n/$1/m; - $str =~ s/(\t\.align .(?:,0x90)?\n)\.globl\s+.*_?__stg_split_marker.*\n/$1/m; - - # it seems prudent to stick on one of these: - $str = "\.text\n\t.align 4\n" . $str; - - # remove/record any literal constants defined here - # [perl made uglier to work around the perl 5.7/5.8 bug documented at - # http://bugs6.perl.org/rt2/Ticket/Display.html?id=1760 and illustrated - # by the seg fault of perl -e '("x\n" x 5000) =~ /(.*\n)+/' - # -- ccshan 2002-09-05] - while ( ($str =~ /((?:^|\.)(LC\d+):\n(\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/m )) { - local($label) = $2; - local($body) = $1; - local($prefix, $suffix) = ($`, $'); - - &tidy_up_and_die(1,"Local constant label $label already defined!\n") - if $LocalConstant{$label}; - - while ( $suffix =~ /^((\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/ ) { - $body .= $1; - $suffix = $'; - } - $LocalConstant{$label} = $body; - $str = $prefix . $suffix; - } - - # inject definitions for any local constants now used herein - foreach $k (keys %LocalConstant) { - if ( $str =~ /\b$k\b/m ) { - $str = $LocalConstant{$k} . $str; - } - } - - print STDERR "### STRIPPED BLOCK (iX86):\n$str" if $Dump_asm_splitting_info; - - $str; -} - -sub process_asm_block_x86_64 { - local($str) = @_; - - # remove/record any literal constants defined here - # [perl made uglier to work around the perl 5.7/5.8 bug documented at - # http://bugs6.perl.org/rt2/Ticket/Display.html?id=1760 and illustrated - # by the seg fault of perl -e '("x\n" x 5000) =~ /(.*\n)+/' - # -- ccshan 2002-09-05] - while ( ($str =~ /((?:^|\.)(LC\d+):\n(\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/m )) { - local($label) = $2; - local($body) = $1; - local($prefix, $suffix) = ($`, $'); - - &tidy_up_and_die(1,"Local constant label $label already defined!\n") - if $LocalConstant{$label}; - - while ( $suffix =~ /^((\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/ ) { - $body .= $1; - $suffix = $'; - } - $LocalConstant{$label} = $body; - $str = $prefix . $suffix; - } - - # inject definitions for any local constants now used herein - foreach $k (keys %LocalConstant) { - if ( $str =~ /\b$k\b/m ) { - $str = $LocalConstant{$k} . $str; - } - } - - print STDERR "### STRIPPED BLOCK (x86_64):\n$str" if $Dump_asm_splitting_info; - - $str; -} - -sub process_asm_block_powerpc_linux { - local($str) = @_; - - # strip the marker - $str =~ s/__stg_split_marker.*\n//m; - - # remove/record any literal constants defined here - while ( $str =~ s/^(\s+.section\s+\.rodata\n\s+\.align.*\n(\.LC\d+):\n(\s\.(byte|short|long|quad|2byte|4byte|8byte|fill|space|ascii|string).*\n)+)//m ) { - local($label) = $2; - local($body) = $1; - - &tidy_up_and_die(1,"Local constant label $label already defined!\n") - if $LocalConstant{$label}; - - $LocalConstant{$label} = $body; - } - - # inject definitions for any local constants now used herein - foreach $k (keys %LocalConstant) { - if ( $str =~ /[\s,]$k\b/m ) { - $str = $LocalConstant{$k} . $str; - } - } - - print STDERR "### STRIPPED BLOCK (powerpc linux):\n$str" if $Dump_asm_splitting_info; - - $str; -} - -sub tidy_up_and_die { - local($return_val, $msg) = @_; - print STDERR $msg; - exit (($return_val == 0) ? 0 : 1); -} diff --git a/driver/split/ghc.mk b/driver/split/ghc.mk deleted file mode 100644 index 9d34a59a24..0000000000 --- a/driver/split/ghc.mk +++ /dev/null @@ -1,20 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 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://ghc.haskell.org/trac/ghc/wiki/Building/Architecture -# http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying -# -# ----------------------------------------------------------------------------- - -driver/split_PERL_SRC = ghc-split.pl -driver/split_dist_PROGNAME = ghc-split -driver/split_dist_TOPDIR = YES -driver/split_dist_INSTALL = YES -driver/split_dist_INSTALL_INPLACE = YES - -$(eval $(call build-perl,driver/split,dist)) - @@ -330,11 +330,6 @@ include rules/build-prog.mk include rules/shell-wrapper.mk # ----------------------------------------------------------------------------- -# Build a perl script - -include rules/build-perl.mk - -# ----------------------------------------------------------------------------- # Build a package include rules/build-package.mk @@ -630,7 +625,6 @@ BUILD_DIRS += utils/mkdirhier BUILD_DIRS += utils/touchy BUILD_DIRS += utils/unlit BUILD_DIRS += utils/hp2ps -BUILD_DIRS += driver/split BUILD_DIRS += utils/genprimopcode BUILD_DIRS += driver BUILD_DIRS += driver/ghci @@ -705,9 +699,6 @@ endif ifeq "$(Windows_Host)" "NO" BUILD_DIRS := $(filter-out utils/touchy,$(BUILD_DIRS)) endif -ifeq "$(GhcUnregisterised)" "YES" -BUILD_DIRS := $(filter-out driver/split,$(BUILD_DIRS)) -endif ifeq "$(GhcWithInterpreter)" "NO" # runghc is just GHCi in disguise BUILD_DIRS := $(filter-out utils/runghc,$(BUILD_DIRS)) @@ -1435,7 +1426,6 @@ distclean : clean # Also clean Windows-only inplace directories. # Don't delete 'inplace' itself, it contains source files. $(call removeTrees,inplace/mingw) - $(call removeTrees,inplace/perl) # Remove the fs utilities. $(call removeFiles,utils/lndir/fs.h) diff --git a/ghc/ghc.mk b/ghc/ghc.mk index 6e329352ef..f9a3d1f056 100644 --- a/ghc/ghc.mk +++ b/ghc/ghc.mk @@ -154,12 +154,6 @@ $(GHC_STAGE1) : | $(GHC_DEPENDENCIES) $(GHC_STAGE2) : | $(GHC_DEPENDENCIES) $(GHC_STAGE3) : | $(GHC_DEPENDENCIES) -ifeq "$(GhcUnregisterised)" "NO" -$(GHC_STAGE1) : | $$(ghc-split_INPLACE) -$(GHC_STAGE2) : | $$(ghc-split_INPLACE) -$(GHC_STAGE3) : | $$(ghc-split_INPLACE) -endif - ifeq "$(Windows_Host)" "YES" $(GHC_STAGE1) : | $$(touchy_INPLACE) $(GHC_STAGE2) : | $$(touchy_INPLACE) diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in index 344706d630..6feca2098b 100644 --- a/hadrian/cfg/system.config.in +++ b/hadrian/cfg/system.config.in @@ -43,7 +43,6 @@ hs-cpp-args = @HaskellCPPArgs@ #=============== solaris-broken-shld = @SOLARIS_BROKEN_SHLD@ -split-objects-broken = @SplitObjsBroken@ ghc-unregisterised = @Unregisterised@ ghc-source-path = @hardtop@ leading-underscore = @LeadingUnderscore@ diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index 7c5989908a..dd46a9ce19 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -295,7 +295,6 @@ generateConfigHs = do | intLib == integerGmp = "IntegerGMP" | intLib == integerSimple = "IntegerSimple" | otherwise = error $ "Unknown integer library: " ++ pkgName intLib - cSupportsSplitObjs <- expr $ yesNo <$> supportsSplitObjects cGhcWithInterpreter <- expr $ yesNo <$> ghcWithInterpreter cGhcWithNativeCodeGen <- expr $ yesNo <$> ghcWithNativeCodeGen cGhcWithSMP <- expr $ yesNo <$> ghcWithSMP @@ -347,8 +346,6 @@ generateConfigHs = do , "cIntegerLibrary = " ++ show (pkgName intLib) , "cIntegerLibraryType :: IntegerLibrary" , "cIntegerLibraryType = " ++ cIntegerLibraryType - , "cSupportsSplitObjs :: String" - , "cSupportsSplitObjs = " ++ show cSupportsSplitObjs , "cGhcWithInterpreter :: String" , "cGhcWithInterpreter = " ++ show cGhcWithInterpreter , "cGhcWithNativeCodeGen :: String" diff --git a/hadrian/src/Rules/Library.hs b/hadrian/src/Rules/Library.hs index b53bcc8a8c..d1e8840b11 100644 --- a/hadrian/src/Rules/Library.hs +++ b/hadrian/src/Rules/Library.hs @@ -117,14 +117,7 @@ libraryObjects context@Context{..} = do -- This will create split objects if required (we don't track them -- explicitly as this would needlessly bloat the Shake database). need $ noHsObjs ++ hsObjs - - split <- interpretInContext context =<< splitObjects <$> flavour - let getSplitObjs = concatForM hsObjs $ \obj -> do - let dir = dropExtension obj ++ "_" ++ osuf way ++ "_split" - contents <- liftIO $ IO.getDirectoryContents dir - return . map (dir -/-) $ filter (not . all (== '.')) contents - - (noHsObjs ++) <$> if split then getSplitObjs else return hsObjs + return (noHsObjs ++ hsObjs) -- * Library paths types and parsers diff --git a/mk/config.mk.in b/mk/config.mk.in index fb823ae29b..7e3b8062be 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -327,39 +327,9 @@ GhcLibHcOpts=-O2 -haddock StripLibraries=NO # ---------------------------------------------------------------------------- -# Object-file splitting -# -# Set SplitObjs=YES or NO in your build.mk -# -# Don't use -split-objs in in GhcLibHcOpts, because the build -# system needs to do other special magic if you are -# doing object-file splitting - -ArchSupportsSplitObjs=$(if $(filter \ - $(TargetArch_CPP),i386 x86_64 powerpc sparc),YES,NO)# - -# We used to support splitting on Darwin, but there is no point, since Darwin -# uses subsections via symbols -OsSupportsSplitObjs=$(if $(filter $(TargetOS_CPP),\ - mingw32 linux solaris2 freebsd dragonfly netbsd openbsd),YES,NO) -SplitObjsBroken = @SplitObjsBroken@ - -SupportsSplitObjs := $(if $(and $(filter YES,$(ArchSupportsSplitObjs)),\ - $(filter YES,$(OsSupportsSplitObjs)),\ - $(filter NO,$(SplitObjsBroken)),\ - $(filter YES,$(GhcWithNativeCodeGen))),YES,NO) - -# By default, enable SplitObjs for the libraries if this build supports it. -# Unless SplitSections is enabled - then let that take precedence. -SplitObjs = $(if $(and $(filter YES,$(SupportsSplitObjs)),\ - $(filter NO,$(SplitSections))),YES,NO) - -# ---------------------------------------------------------------------------- # Section splitting # -# Similar to -ffunction-sections -fdata-sections in GCC. Provides space saving -# like SplitObjs, but doesn't require post-processing and splitting of object -# files. +# Similar to -ffunction-sections -fdata-sections in GCC. # # Set SplitSections=YES or NO in your build.mk to override the default. # diff --git a/mk/flavours/bench-cross-ncg.mk b/mk/flavours/bench-cross-ncg.mk index 6b686af5c4..bca6662352 100644 --- a/mk/flavours/bench-cross-ncg.mk +++ b/mk/flavours/bench-cross-ncg.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O0 GhcLibHcOpts = -O2 BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/bench-cross.mk b/mk/flavours/bench-cross.mk index ae67f34d17..7d1d4c4260 100644 --- a/mk/flavours/bench-cross.mk +++ b/mk/flavours/bench-cross.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O0 -fllvm GhcLibHcOpts = -O2 -fllvm BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/bench-llvm.mk b/mk/flavours/bench-llvm.mk index 9b71005615..58fb92df21 100644 --- a/mk/flavours/bench-llvm.mk +++ b/mk/flavours/bench-llvm.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O0 GhcLibHcOpts = -O2 BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/bench.mk b/mk/flavours/bench.mk index 0a7cf80fbd..12d620f273 100644 --- a/mk/flavours/bench.mk +++ b/mk/flavours/bench.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O0 GhcLibHcOpts = -O2 BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/devel1.mk b/mk/flavours/devel1.mk index 8c8925c934..e062a57909 100644 --- a/mk/flavours/devel1.mk +++ b/mk/flavours/devel1.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O0 -DDEBUG GhcStage2HcOpts = -O GhcLibHcOpts = -O -dcore-lint BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/devel2.mk b/mk/flavours/devel2.mk index 34808a3c9b..f3c99e010b 100644 --- a/mk/flavours/devel2.mk +++ b/mk/flavours/devel2.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O0 -DDEBUG GhcLibHcOpts = -O -dcore-lint BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/perf-cross-ncg.mk b/mk/flavours/perf-cross-ncg.mk index 4b94c48805..56ecc79b13 100644 --- a/mk/flavours/perf-cross-ncg.mk +++ b/mk/flavours/perf-cross-ncg.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O2 GhcStage2HcOpts = -O2 GhcLibHcOpts = -O2 BUILD_PROF_LIBS = YES -#SplitObjs HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/perf-cross.mk b/mk/flavours/perf-cross.mk index f202642b7d..9e48ce9605 100644 --- a/mk/flavours/perf-cross.mk +++ b/mk/flavours/perf-cross.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O2 GhcStage2HcOpts = -O2 -fllvm GhcLibHcOpts = -O2 -fllvm BUILD_PROF_LIBS = YES -#SplitObjs HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/perf-llvm.mk b/mk/flavours/perf-llvm.mk index cd3d4f4a40..2598f4a40d 100644 --- a/mk/flavours/perf-llvm.mk +++ b/mk/flavours/perf-llvm.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O2 GhcLibHcOpts = -O2 BUILD_PROF_LIBS = YES -#SplitObjs #HADDOCK_DOCS #BUILD_SPHINX_HTML #BUILD_SPHINX_PDF diff --git a/mk/flavours/perf.mk b/mk/flavours/perf.mk index 06fcc246da..374b26c09b 100644 --- a/mk/flavours/perf.mk +++ b/mk/flavours/perf.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O2 GhcLibHcOpts = -O2 BUILD_PROF_LIBS = YES -#SplitObjs #HADDOCK_DOCS #BUILD_SPHINX_HTML #BUILD_SPHINX_PDF diff --git a/mk/flavours/prof-llvm.mk b/mk/flavours/prof-llvm.mk index dcbd6a4bab..9c284432aa 100644 --- a/mk/flavours/prof-llvm.mk +++ b/mk/flavours/prof-llvm.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O GhcLibHcOpts = -O BUILD_PROF_LIBS = YES -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/prof.mk b/mk/flavours/prof.mk index 67f89e61af..b9e8f9ae17 100644 --- a/mk/flavours/prof.mk +++ b/mk/flavours/prof.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O GhcLibHcOpts = -O BUILD_PROF_LIBS = YES -SplitObjs = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/quick-cross-ncg.mk b/mk/flavours/quick-cross-ncg.mk index 97352ccd3e..20e36ef53a 100644 --- a/mk/flavours/quick-cross-ncg.mk +++ b/mk/flavours/quick-cross-ncg.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O0 GhcLibHcOpts = -O BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/quick-cross.mk b/mk/flavours/quick-cross.mk index f0f00d28ac..98defa700c 100644 --- a/mk/flavours/quick-cross.mk +++ b/mk/flavours/quick-cross.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O0 -fllvm GhcLibHcOpts = -O -fllvm BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/quick-llvm.mk b/mk/flavours/quick-llvm.mk index 8a5c5e1c26..9869041012 100644 --- a/mk/flavours/quick-llvm.mk +++ b/mk/flavours/quick-llvm.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O0 GhcLibHcOpts = -O BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/quick.mk b/mk/flavours/quick.mk index 735de6a71d..6f5c44b1cf 100644 --- a/mk/flavours/quick.mk +++ b/mk/flavours/quick.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O0 GhcLibHcOpts = -O BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/quickest.mk b/mk/flavours/quickest.mk index 61e091c54b..a1dec7ffc7 100644 --- a/mk/flavours/quickest.mk +++ b/mk/flavours/quickest.mk @@ -3,7 +3,6 @@ GhcStage1HcOpts = -O GhcStage2HcOpts = -O0 GhcLibHcOpts = -O0 BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/mk/flavours/validate.mk b/mk/flavours/validate.mk index 2ff7c20e2d..fe5e2bdc68 100644 --- a/mk/flavours/validate.mk +++ b/mk/flavours/validate.mk @@ -4,7 +4,6 @@ GhcStage1HcOpts = -O -DDEBUG GhcStage2HcOpts = -O -dcore-lint -dno-debug-output GhcLibHcOpts = -O -dcore-lint -dno-debug-output BUILD_PROF_LIBS = NO -SplitObjs = NO SplitSections = NO HADDOCK_DOCS = YES BUILD_SPHINX_HTML = YES diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk index 8d14b7a3e2..e01034a297 100644 --- a/rules/build-package-way.mk +++ b/rules/build-package-way.mk @@ -74,12 +74,7 @@ else # ifneq "$3" "dyn" # Build the ordinary .a library $$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(call removeFiles,$$@ $$@.contents) -ifeq "$$($1_$2_SplitObjs)" "YES" - $$(FIND) $$(patsubst %.$$($3_osuf),%_$$($3_osuf)_split,$$($1_$2_$3_HS_OBJS)) -name '*.$$($3_osuf)' -print >> $$@.contents - echo $$($1_$2_$3_NON_HS_OBJS) >> $$@.contents -else echo $$($1_$2_$3_ALL_OBJS) >> $$@.contents -endif ifeq "$$($1_$2_ArSupportsAtFile)" "YES" $$(call cmd,$1_$2_AR) $$($1_$2_AR_OPTS) $$($1_$2_EXTRA_AR_ARGS) $$@ @$$@.contents else diff --git a/rules/build-perl.mk b/rules/build-perl.mk deleted file mode 100644 index 6bec7d93e7..0000000000 --- a/rules/build-perl.mk +++ /dev/null @@ -1,78 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 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://ghc.haskell.org/trac/ghc/wiki/Building/Architecture -# http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying -# -# ----------------------------------------------------------------------------- - - -# Build a perl script. Invoke like this: -# -# driver/mangler_PERL_SRC = ghc-asm.pl -# driver/mangler_dist_PROGNAME = ghc-asm -# -# $(eval $(call build-perl,driver/mangler,dist)) - -define build-perl -$(call trace, build-perl($1,$2)) -$(call profStart, build-perl($1,$2)) -# $1 = dir -# $2 = distdir - -ifeq "$$($1_$2_PROGNAME)" "" -$$(error $1_$2_PROGNAME is not set) -endif -ifneq "$$($1_$2_PROG)" "" -$$(error $1_$2_PROG is set) -endif -$1_$2_PROG = $$($1_$2_PROGNAME) - -ifneq "$$($$($1_$2_PROG)_INPLACE)" "" -$$(error $$($1_$2_PROG)_INPLACE defined twice) -endif -ifeq "$$($1_$2_TOPDIR)" "YES" -$$($1_$2_PROG)_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG) -else -$$($1_$2_PROG)_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG) -endif - -$1_$2_INPLACE = $$($$($1_$2_PROG)_INPLACE) - -$(call all-target,$1_$2,$$($1_$2_INPLACE)) - -$(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE)) -.PHONY: clean_$1 -clean_$1 : clean_$1_$2 - -ifneq "$$(BINDIST)" "YES" - -$1/$2/$$($1_$2_PROG): $1/$$/$$($1_PERL_SRC) $$$$(unlit_INPLACE) | $$$$(dir $$$$@)/. - $$(call removeFiles,$$@) - echo '#!$$(PERL)' >> $$@ - echo 'my $$$$TARGETPLATFORM = "$$(TARGETPLATFORM)";' >> $$@ - echo 'my $$$$TABLES_NEXT_TO_CODE = "$(GhcEnableTablesNextToCode)";' >> $$@ - cat $$< >> $$@ - -$$($1_$2_INPLACE): $1/$2/$$($1_$2_PROG) | $$$$(dir $$$$@)/. - "$$(CP)" $$< $$@ - $$(EXECUTABLE_FILE) $$@ -endif - -ifeq "$$($1_$2_INSTALL)" "YES" -# Don't add to INSTALL_BINS or INSTALL_LIBEXECS, because they will get -# stripped when calling 'make install-strip', and stripping a Perl script -# doesn't work. -ifeq "$$($1_$2_TOPDIR)" "YES" -INSTALL_LIBEXEC_SCRIPTS += $$($1_$2_INPLACE) -else -INSTALL_SCRIPTS += $$($1_$2_INPLACE) -endif -endif - -$(call profEnd, build-perl($1,$2)) -endef diff --git a/rules/distdir-opts.mk b/rules/distdir-opts.mk index 6cabac35d2..b8f10bb2ca 100644 --- a/rules/distdir-opts.mk +++ b/rules/distdir-opts.mk @@ -89,14 +89,6 @@ $1_$2_ALL_HAPPY_OPTS = \ $$($1_$2_HAPPY_OPTS) \ $$(EXTRA_HAPPY_OPTS) -# We don't bother splitting the bootstrap packages (built with stage 0) -ifeq "$$($1_$2_SplitObjs)" "" -ifeq "$$(SplitObjs) $3" "YES 1" -$1_$2_SplitObjs = YES -else -$1_$2_SplitObjs = NO -endif -endif # Disable split sections when building with stage0, it won't be supported yet # and it's probably not very relevant anyway (smaller stage1 ghc?). ifeq "$$($1_$2_SplitSections)" "" diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk index 45dc0ce988..4ffbd3a44d 100644 --- a/rules/distdir-way-opts.mk +++ b/rules/distdir-way-opts.mk @@ -163,7 +163,6 @@ $1_$2_$3_MOST_DIR_HC_OPTS = \ $1_$2_$3_ALL_HC_OPTS = \ -hisuf $$($3_hisuf) -osuf $$($3_osuf) -hcsuf $$($3_hcsuf) \ $$($1_$2_$3_MOST_DIR_HC_OPTS) \ - $$(if $$(findstring YES,$$($1_$2_SplitObjs)),$$(if $$(findstring dyn,$3),,-split-objs),) \ $$(if $$(findstring YES,$$($1_$2_SplitSections)),$$(if $$(findstring dyn,$3),,-split-sections),) \ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),$$(if $$(findstring v,$3),-dynamic-too)) |