Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 073cc512 by Zubin Duggal at 2026-04-03T06:20:48-04:00 driver: recognise .dyn_o as a valid object file to link if passed on the command line. This allows plugins compiled with this suffix to run. Fixes #24486 - - - - - 24214d9b by Simon Jakobi at 2026-04-03T06:20:50-04:00 Add regression test for #16145 Closes #16145. - - - - - 18ad8d01 by Matthew Pickering at 2026-04-03T06:20:51-04:00 bytecode: Add magic header/version to bytecode files In order to avoid confusing errors when using stale interface files (ie from an older compiler version), we add a simple header/version check like the one for interface files. Fixes #27068 - - - - - 9aeadd8d by fendor at 2026-04-03T06:20:51-04:00 Add constants for bytecode in-memory buffer size Introduce a common constant for the default size of the .gbc and .bytecodelib binary buffer. The buffer is by default set to 1 MB. - - - - - 3e502226 by mangoiv at 2026-04-03T06:20:52-04:00 testsuite: filter stderr for static001 on darwin This reactivates the test on x86_64 darwin as this should have been done long ago and ignores warnings emitted by ranlib on newer version of the darwin toolchain since they are benign. (no symbols for stub libraries) Fixes #27116 - - - - - 6155409d by mangoiv at 2026-04-03T06:20:53-04:00 issue template: fix add bug label - - - - - 5c379cd1 by Sylvain Henry at 2026-04-03T06:21:01-04:00 Add more canned GC functions for common register patterns (#27142) Based on analysis of heap-check sites across the GHC compiler and Cabal, the following patterns were not covered by existing canned GC functions but occurred frequently enough to warrant specialisation: stg_gc_ppppp -- 5 GC pointers stg_gc_ip -- unboxed word + GC pointer stg_gc_pi -- GC pointer + unboxed word stg_gc_ii -- two unboxed words stg_gc_bpp -- byte (I8) + two GC pointers Adding these reduces the fraction of heap-check sites falling back to the generic GC path from ~1.4% to ~0.4% when compiling GHC itself. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> - - - - - 68a32628 by Matthew Pickering at 2026-04-03T06:21:02-04:00 Make home unit dependencies stored as sets Co-authored-by: Wolfgang Jeltsch <wolfgang@well-typed.com> - - - - - 29 changed files: - .gitlab/issue_templates/default.md - compiler/GHC/ByteCode/Serialize.hs - compiler/GHC/Driver/Phases.hs - compiler/GHC/Linker/Loader.hs - compiler/GHC/Rename/Names.hs - compiler/GHC/StgToCmm/Heap.hs - compiler/GHC/Unit/Finder.hs - compiler/GHC/Unit/Home/Graph.hs - compiler/GHC/Unit/State.hs - rts/HeapStackCheck.cmm - rts/RtsSymbols.c - rts/include/stg/MiscClosures.h - testsuite/driver/testlib.py - testsuite/tests/driver/all.T - testsuite/tests/driver/bytecode-object/Makefile - testsuite/tests/driver/bytecode-object/all.T - testsuite/tests/plugins/Makefile - + testsuite/tests/plugins/T24486-plugin/Makefile - + testsuite/tests/plugins/T24486-plugin/Setup.hs - + testsuite/tests/plugins/T24486-plugin/T24486-plugin.cabal - + testsuite/tests/plugins/T24486-plugin/T24486_Plugin.hs - + testsuite/tests/plugins/T24486.hs - + testsuite/tests/plugins/T24486_Helper.hs - testsuite/tests/plugins/all.T - testsuite/tests/runghc/Makefile - + testsuite/tests/runghc/T16145.hs - + testsuite/tests/runghc/T16145.stdout - + testsuite/tests/runghc/T16145_aux.hs - testsuite/tests/runghc/all.T Changes: ===================================== .gitlab/issue_templates/default.md ===================================== @@ -20,5 +20,5 @@ Optional: * System Architecture: -/label ~bug +/label ~"T::bug" /label ~"needs triage" ===================================== compiler/GHC/ByteCode/Serialize.hs ===================================== @@ -25,22 +25,26 @@ where import GHC.Prelude import GHC.ByteCode.Binary -import GHC.ByteCode.Types import GHC.ByteCode.Recomp.Binary (computeFingerprint) -import GHC.Driver.Env +import GHC.ByteCode.Types import GHC.Driver.DynFlags +import GHC.Driver.Env import GHC.Iface.Binary import GHC.Iface.Recomp.Binary (putNameLiterally) import GHC.Linker.Types +import GHC.Settings.Constants (hiVersion) import GHC.Unit.Types import GHC.Utils.Binary -import GHC.Utils.TmpFs -import GHC.Utils.Logger import GHC.Utils.Fingerprint (Fingerprint) +import GHC.Utils.Logger +import GHC.Utils.Panic +import GHC.Utils.TmpFs import Data.ByteString (ByteString) -import qualified Data.ByteString as BS +import Data.ByteString qualified as BS +import Data.Char (ord) import Data.Traversable +import Data.Word import System.Directory import System.FilePath @@ -79,21 +83,35 @@ The ticket where bytecode objects were dicussed is #26298 See Note [-fwrite-byte-code is not the default] See Note [Recompilation avoidance with bytecode objects] +See Note [Persistent bytecode file headers] +Note [Persistent bytecode file headers] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Persistent bytecode files (`.gbc`) and bytecode libraries (`.bytecodelib`) +are version-specific binary formats. Without a small file-level header, stale +or corrupt files are only discovered once we start deserialising the payload, +which can lead to confusing failures. + +To make these failures explicit, we write a file-kind-specific magic word and +the current `hiVersion` ahead of the binary payload. Readers validate this +header before setting up the normal `Name`/`FastString` deserialisation +machinery. This follows the same approach as normal interface files. -} writeBytecodeLib :: BytecodeLib -> FilePath -> IO () writeBytecodeLib lib path = do odbco <- encodeBytecodeLib lib createDirectoryIfMissing True (takeDirectory path) - bh' <- openBinMem (1024 * 1024) + bh' <- openBinMem initBinMemSize bh <- addBinNameWriter bh' + writePersistentBytecodeHeader BytecodeLibraryFile bh putWithUserData QuietBinIFace NormalCompression bh odbco writeBinMem bh path readBytecodeLib :: HscEnv -> FilePath -> IO OnDiskBytecodeLib readBytecodeLib hsc_env path = do bh' <- readBinMem path + readPersistentBytecodeHeader BytecodeLibraryFile path bh' bh <- addBinNameReader (hsc_NC hsc_env) bh' res <- getWithUserData (hsc_NC hsc_env) bh pure res @@ -185,6 +203,7 @@ readBinByteCode hsc_env f = do readOnDiskModuleByteCode :: HscEnv -> FilePath -> IO OnDiskModuleByteCode readOnDiskModuleByteCode hsc_env f = do bh' <- readBinMem f + readPersistentBytecodeHeader ModuleByteCodeFile f bh' bh <- addBinNameReader (hsc_NC hsc_env) bh' getWithUserData (hsc_NC hsc_env) bh @@ -192,9 +211,10 @@ readOnDiskModuleByteCode hsc_env f = do writeBinByteCode :: FilePath -> ModuleByteCode -> IO () writeBinByteCode f cbc = do createDirectoryIfMissing True (takeDirectory f) - bh' <- openBinMem (1024 * 1024) + bh' <- openBinMem initBinMemSize bh <- addBinNameWriter bh' odbco <- encodeOnDiskModuleByteCode cbc + writePersistentBytecodeHeader ModuleByteCodeFile bh putWithUserData QuietBinIFace NormalCompression bh odbco writeBinMem bh f @@ -213,3 +233,64 @@ fingerprintModuleByteCodeContents :: Module -> CompiledByteCode -> [FilePath] -> fingerprintModuleByteCodeContents modl cbc foreign_files = do foreign_contents <- readObjectFiles foreign_files pure $ computeFingerprint putNameLiterally (modl, cbc, foreign_contents) + +-- ---------------------------------------------------------------------------- +-- ByteCode module and library magic header. +-- ---------------------------------------------------------------------------- + +data PersistentBytecodeFile + = ModuleByteCodeFile + | BytecodeLibraryFile + +-- See Note [Persistent bytecode file headers] +writePersistentBytecodeHeader :: PersistentBytecodeFile -> WriteBinHandle -> IO () +writePersistentBytecodeHeader file_kind bh = do + put_ bh (persistentBytecodeMagic file_kind) + put_ bh (show hiVersion) + +readPersistentBytecodeHeader :: PersistentBytecodeFile -> FilePath -> ReadBinHandle -> IO () +readPersistentBytecodeHeader file_kind path bh = do + let mismatch what expected actual = + throwGhcExceptionIO $ ProgramError $ + persistentBytecodeFileDescription file_kind ++ " header mismatch in " ++ path ++ + ": " ++ what ++ " (expected " ++ expected ++ ", got " ++ actual ++ ")" + + magic <- get bh + let expected_magic = persistentBytecodeMagic file_kind + if unFixedLength magic == unFixedLength expected_magic + then pure () + else mismatch "magic" (show $ unFixedLength expected_magic) (show $ unFixedLength magic) + + version <- get bh + let expected_version = show hiVersion + if version == expected_version + then pure () + else mismatch "version" expected_version version + +persistentBytecodeFileDescription :: PersistentBytecodeFile -> String +persistentBytecodeFileDescription ModuleByteCodeFile = "bytecode file" +persistentBytecodeFileDescription BytecodeLibraryFile = "bytecode library" + +persistentBytecodeMagic :: PersistentBytecodeFile -> FixedLengthEncoding Word32 +persistentBytecodeMagic file_kind = + case file_kind of + ModuleByteCodeFile -> asciiWord32 "gbc0" + BytecodeLibraryFile -> asciiWord32 "bcl0" + +-- | Encode a 4-letter word into a single Word32. +asciiWord32 :: String -> FixedLengthEncoding Word32 +asciiWord32 [a, b, c, d] = + FixedLengthEncoding $ + (fromIntegral (ord a) `shiftL` 24) .|. + (fromIntegral (ord b) `shiftL` 16) .|. + (fromIntegral (ord c) `shiftL` 8) .|. + fromIntegral (ord d) +asciiWord32 _ = error "asciiWord32: expected exactly four ASCII characters" + +-- ---------------------------------------------------------------------------- +-- Constants and utils +-- ---------------------------------------------------------------------------- + +-- | Initial ram buffer to allocate for writing .gbc and .bytecodelib files. +initBinMemSize :: Int +initBinMemSize = 1024 * 1024 -- 1 MB ===================================== compiler/GHC/Driver/Phases.hs ===================================== @@ -262,7 +262,7 @@ objish_suffixes :: Platform -> [String] -- the GHC-compiled code will run objish_suffixes platform = case platformOS platform of OSMinGW32 -> [ "o", "O", "obj", "OBJ" ] - _ -> [ "o" ] + _ -> [ "o", "dyn_o"] dynlib_suffixes :: Platform -> [String] dynlib_suffixes platform = case platformOS platform of ===================================== compiler/GHC/Linker/Loader.hs ===================================== @@ -402,7 +402,7 @@ loadCmdLineLibs' interp hsc_env pls = snd <$> let hsc' = hscSetActiveUnitId uid hsc_env -- Load potential dependencies first (done', pls') <- foldM (\(done', pls') uid -> load done' uid pls') (done, pls) - (homeUnitDepends (hsc_units hsc')) + (Set.toList (homeUnitDepends (hsc_units hsc'))) pls'' <- loadCmdLineLibs'' interp hsc' pls' return $ (Set.insert uid done', pls'') ===================================== compiler/GHC/Rename/Names.hs ===================================== @@ -467,11 +467,14 @@ renamePkgQual unit_env mn mb_pkg = case mb_pkg of -- not really correct as pkg_fs is unlikely to be a valid unit-id but -- we will report the failure later... where - home_names = map (\uid -> (uid, mkFastString <$> thisPackageName (homeUnitEnv_dflags (ue_findHomeUnitEnv uid unit_env)))) hpt_deps + home_names = + [ (uid, mkFastString <$> thisPackageName (homeUnitEnv_dflags (ue_findHomeUnitEnv uid unit_env))) + | uid <- S.toList hpt_deps + ] unit_state = ue_homeUnitState unit_env - hpt_deps :: [UnitId] + hpt_deps :: S.Set UnitId hpt_deps = homeUnitDepends unit_state ===================================== compiler/GHC/StgToCmm/Heap.hs ===================================== @@ -1,3 +1,4 @@ +{-# LANGUAGE OverloadedStrings #-} ----------------------------------------------------------------------------- -- -- Stg to C--: heap management functions @@ -44,7 +45,7 @@ import GHC.Types.Id ( Id ) import GHC.Unit import GHC.Platform import GHC.Platform.Profile -import GHC.Data.FastString( mkFastString, fsLit ) +import GHC.Data.FastString( FastString ) import GHC.Utils.Panic( sorry ) import Control.Monad (when) @@ -125,7 +126,7 @@ allocHeapClosure rep info_ptr use_cc payload = do -- ie 1 *before* the info-ptr word of new object. base <- getHpRelOffset info_offset - emitComment $ mkFastString "allocHeapClosure" + emitComment "allocHeapClosure" emitSetDynHdr base info_ptr use_cc -- Fill in the fields @@ -460,35 +461,41 @@ genericGC checkYield code call <- mkCall generic_gc (GC, GC) [] [] updfr_sz [] heapCheck False checkYield (call <*> mkBranch lretry) code +-- | Predefined ("canned") GC functions +-- +-- Functions have been added to cover 99% of the GC calls made in GHC and Cabal. +-- See #27142. cannedGCEntryPoint :: Platform -> [LocalReg] -> Maybe CmmExpr -cannedGCEntryPoint platform regs - = case map localRegType regs of - [] -> Just (mkGcLabel "stg_gc_noregs") - [ty] - | isGcPtrType ty -> Just (mkGcLabel "stg_gc_unpt_r1") - | isFloatType ty -> case width of - W32 -> Just (mkGcLabel "stg_gc_f1") - W64 -> Just (mkGcLabel "stg_gc_d1") - _ -> Nothing - - | width == wordWidth platform -> Just (mkGcLabel "stg_gc_unbx_r1") - | width == W64 -> Just (mkGcLabel "stg_gc_l1") - | otherwise -> Nothing - where - width = typeWidth ty - [ty1,ty2] - | isGcPtrType ty1 - && isGcPtrType ty2 -> Just (mkGcLabel "stg_gc_pp") - [ty1,ty2,ty3] - | isGcPtrType ty1 - && isGcPtrType ty2 - && isGcPtrType ty3 -> Just (mkGcLabel "stg_gc_ppp") - [ty1,ty2,ty3,ty4] - | isGcPtrType ty1 - && isGcPtrType ty2 - && isGcPtrType ty3 - && isGcPtrType ty4 -> Just (mkGcLabel "stg_gc_pppp") - _otherwise -> Nothing +cannedGCEntryPoint platform regs = + case map localRegType regs of + [] -> ret "stg_gc_noregs" + [ty] + | is_gc ty -> ret "stg_gc_unpt_r1" + | is_f32 ty -> ret "stg_gc_f1" + | is_f64 ty -> ret "stg_gc_d1" + | is_wn ty -> ret "stg_gc_unbx_r1" + | is_w64 ty -> ret "stg_gc_l1" + [ty1,ty2] + | is_gc ty1 && is_gc ty2 -> ret "stg_gc_pp" + | is_gc ty1 && is_wn ty2 -> ret "stg_gc_pi" + | is_wn ty1 && is_gc ty2 -> ret "stg_gc_ip" + | is_wn ty1 && is_wn ty2 -> ret "stg_gc_ii" + [ty1,ty2,ty3] + | is_gc ty1 && is_gc ty2 && is_gc ty3 -> ret "stg_gc_ppp" + | is_w8 ty1 && is_gc ty2 && is_gc ty3 -> ret "stg_gc_bpp" + [ty1,ty2,ty3,ty4] + | is_gc ty1 && is_gc ty2 && is_gc ty3 && is_gc ty4 -> ret "stg_gc_pppp" + [ty1,ty2,ty3,ty4,ty5] + | is_gc ty1 && is_gc ty2 && is_gc ty3 && is_gc ty4 && is_gc ty5 -> ret "stg_gc_ppppp" + _ -> Nothing + where + ret fs = Just (mkGcLabel fs) + is_gc ty = isGcPtrType ty + is_wn ty = isBitsType ty && typeWidth ty == wordWidth platform + is_w8 ty = isBitsType ty && typeWidth ty == W8 + is_w64 ty = isBitsType ty && typeWidth ty == W64 + is_f32 ty = isFloatType ty && typeWidth ty == W32 + is_f64 ty = isFloatType ty && typeWidth ty == W64 -- Note [stg_gc arguments] -- ~~~~~~~~~~~~~~~~~~~~~~~ @@ -514,8 +521,8 @@ generic_gc :: CmmExpr generic_gc = mkGcLabel "stg_gc_noregs" -- | Create a CLabel for calling a garbage collector entry point -mkGcLabel :: String -> CmmExpr -mkGcLabel s = CmmLit (CmmLabel (mkCmmCodeLabel rtsUnitId (fsLit s))) +mkGcLabel :: FastString -> CmmExpr +mkGcLabel s = CmmLit (CmmLabel (mkCmmCodeLabel rtsUnitId s)) ------------------------------- heapCheck :: Bool -> Bool -> CmmAGraph -> FCode a -> FCode a ===================================== compiler/GHC/Unit/Finder.hs ===================================== @@ -72,6 +72,7 @@ import GHC.Driver.Config.Finder import GHC.Types.Unique.Set import qualified Data.List as L(sort) import Data.List.NonEmpty ( NonEmpty (..) ) +import qualified Data.Set as Set (toList) import qualified System.Directory as SD import qualified System.OsPath as OsPath import qualified Data.List.NonEmpty as NE @@ -241,7 +242,7 @@ findImportedModuleNoHsc fc fopts ue mhome_unit mod_name mb_pkg = Nothing -> ue_homeUnitState ue Just home_unit -> HUG.homeUnitEnv_units $ ue_findHomeUnitEnv (homeUnitId home_unit) ue hpt_deps :: [UnitId] - hpt_deps = homeUnitDepends units + hpt_deps = Set.toList (homeUnitDepends units) other_fopts = map (\uid -> (uid, initFinderOpts (homeUnitEnv_dflags (ue_findHomeUnitEnv uid ue)))) hpt_deps -- | Locate a plugin module requested by the user, for a compiler ===================================== compiler/GHC/Unit/Home/Graph.hs ===================================== @@ -229,15 +229,18 @@ updateUnitFlags uid f = unitEnv_adjust update uid -- If the argument unit is not present in the graph returns Nothing. transitiveHomeDeps :: UnitId -> HomeUnitGraph -> Maybe [UnitId] transitiveHomeDeps uid hug = case lookupHugUnitId uid hug of - Nothing -> Nothing + Nothing -> Nothing Just hue -> Just $ - Set.toList (loop (Set.singleton uid) (homeUnitDepends (homeUnitEnv_units hue))) + Set.toList $ + loop (Set.singleton uid) + (Set.toList (homeUnitDepends (homeUnitEnv_units hue))) where loop acc [] = acc loop acc (uid:uids) | uid `Set.member` acc = loop acc uids | otherwise = - let hue = homeUnitDepends + let hue = Set.toList + . homeUnitDepends . homeUnitEnv_units . expectJust $ lookupHugUnitId uid hug @@ -359,7 +362,11 @@ unitEnv_assocs (UnitEnvGraph x) = Map.assocs x hugSCCs :: HomeUnitGraph -> [SCC UnitId] hugSCCs hug = sccs where mkNode :: (UnitId, HomeUnitEnv) -> Node UnitId UnitId - mkNode (uid, hue) = DigraphNode uid uid (homeUnitDepends (homeUnitEnv_units hue)) + mkNode (uid, hue) = DigraphNode + uid + uid + (Set.toList (homeUnitDepends (homeUnitEnv_units hue))) + nodes = map mkNode (Map.toList $ unitEnv_graph hug) sccs = stronglyConnCompFromEdgedVerticesOrd nodes ===================================== compiler/GHC/Unit/State.hs ===================================== @@ -459,7 +459,7 @@ data UnitState = UnitState { -- -Wunused-packages warning. explicitUnits :: [(Unit, Maybe PackageArg)], - homeUnitDepends :: [UnitId], + homeUnitDepends :: Set UnitId, -- | This is a full map from 'ModuleName' to all modules which may possibly -- be providing it. These providers may be hidden (but we'll still want @@ -494,7 +494,7 @@ emptyUnitState = UnitState { unwireMap = emptyUniqMap, preloadUnits = [], explicitUnits = [], - homeUnitDepends = [], + homeUnitDepends = Set.empty, moduleNameProvidersMap = emptyUniqMap, pluginModuleNameProvidersMap = emptyUniqMap, requirementContext = emptyUniqMap, @@ -1718,7 +1718,7 @@ mkUnitState logger cfg = do let !state = UnitState { preloadUnits = dep_preload , explicitUnits = explicit_pkgs - , homeUnitDepends = Set.toList home_unit_deps + , homeUnitDepends = home_unit_deps , unitInfoMap = pkg_db , preloadClosure = emptyUniqSet , moduleNameProvidersMap = mod_map ===================================== rts/HeapStackCheck.cmm ===================================== @@ -373,8 +373,6 @@ stg_gc_l1 return (L_ l) jump stg_gc_noregs (stg_ret_l_info, l) (); } -/*-- Unboxed tuples with multiple pointers -------------------------------- */ - stg_gc_pp return (P_ arg1, P_ arg2) { call stg_gc_noregs(); @@ -393,6 +391,36 @@ stg_gc_pppp return (P_ arg1, P_ arg2, P_ arg3, P_ arg4) return (arg1,arg2,arg3,arg4); } +stg_gc_ppppp return (P_ arg1, P_ arg2, P_ arg3, P_ arg4, P_ arg5) +{ + call stg_gc_noregs(); + return (arg1,arg2,arg3,arg4,arg5); +} + +stg_gc_ip return (W_ arg1, P_ arg2) +{ + call stg_gc_noregs(); + return (arg1,arg2); +} + +stg_gc_pi return (P_ arg1, W_ arg2) +{ + call stg_gc_noregs(); + return (arg1,arg2); +} + +stg_gc_ii return (W_ arg1, W_ arg2) +{ + call stg_gc_noregs(); + return (arg1,arg2); +} + +stg_gc_bpp return (I8 arg1, P_ arg2, P_ arg3) +{ + call stg_gc_noregs(); + return (arg1,arg2,arg3); +} + /* ----------------------------------------------------------------------------- Generic function entry heap check code. ===================================== rts/RtsSymbols.c ===================================== @@ -499,6 +499,11 @@ extern char **environ; SymI_HasDataProto(stg_gc_pp) \ SymI_HasDataProto(stg_gc_ppp) \ SymI_HasDataProto(stg_gc_pppp) \ + SymI_HasDataProto(stg_gc_ppppp) \ + SymI_HasDataProto(stg_gc_ip) \ + SymI_HasDataProto(stg_gc_pi) \ + SymI_HasDataProto(stg_gc_ii) \ + SymI_HasDataProto(stg_gc_bpp) \ SymI_HasDataProto(__stg_gc_fun) \ SymI_HasDataProto(stg_gc_fun_info) \ SymI_HasDataProto(stg_yield_noregs) \ ===================================== rts/include/stg/MiscClosures.h ===================================== @@ -361,6 +361,11 @@ RTS_FUN_DECL(stg_gc_l1); RTS_FUN_DECL(stg_gc_pp); RTS_FUN_DECL(stg_gc_ppp); RTS_FUN_DECL(stg_gc_pppp); +RTS_FUN_DECL(stg_gc_ppppp); +RTS_FUN_DECL(stg_gc_ip); +RTS_FUN_DECL(stg_gc_pi); +RTS_FUN_DECL(stg_gc_ii); +RTS_FUN_DECL(stg_gc_bpp); RTS_RET(stg_gc_fun); RTS_FUN_DECL(__stg_gc_fun); ===================================== testsuite/driver/testlib.py ===================================== @@ -3043,6 +3043,12 @@ def normalise_errmsg(s: str) -> str: # Old emcc warns when we export HEAP8 but new one requires it (see #26290) s = s.replace('warning: invalid item in EXPORTED_RUNTIME_METHODS: HEAP8\nwarning: invalid item in EXPORTED_RUNTIME_METHODS: HEAPU8\nemcc: warning: warnings in JS library compilation [-Wjs-compiler]\n','') + # on newer versions of MacOS X, the shipped ranlib warns about object files with no symbols, + # however, these are completely benign stubs. + # See https://gitlab.haskell.org/ghc/ghc/-/issues/27116 + if opsys('darwin'): + s = modify_lines(s, lambda l: re.sub(r'.*ranlib:.*has no symbols', '', l)) + return s # normalise a .prof file, so that we can reasonably compare it against ===================================== testsuite/tests/driver/all.T ===================================== @@ -120,9 +120,7 @@ if config.os == 'darwin': else: only_darwin = skip -test('static001', [extra_files(['Static001.hs']), - only_darwin, - when(arch('x86_64'), expect_broken(8127))], +test('static001', [extra_files(['Static001.hs']), only_darwin], makefile_test, ['static001']) test('dynHelloWorld', ===================================== testsuite/tests/driver/bytecode-object/Makefile ===================================== @@ -159,3 +159,9 @@ bytecode_object25: "$(TEST_HC)" $(TEST_HC_OPTS) -c BytecodeForeign.hs -fbyte-code -fwrite-byte-code -fwrite-interface $(ghciWayFlags) "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) -v1 -fno-hide-source-paths -fbyte-code -fwrite-byte-code -fwrite-interface BytecodeForeign.hs -e "testForeign" +# Test that corrupt bytecode file headers are rejected clearly. +bytecode_object26: + "$(TEST_HC)" $(TEST_HC_OPTS) -c BytecodeTest.hs -fbyte-code -fwrite-byte-code + @printf 'bad!' | dd of=BytecodeTest.gbc bs=1 count=4 conv=notrunc 2>/dev/null + ! "$(TEST_HC)" $(TEST_HC_OPTS) -c -bytecodelib -o linked.bytecode BytecodeTest.gbc 2> bytecode_object26.stderr + @grep -F "bytecode file header mismatch" bytecode_object26.stderr >/dev/null ===================================== testsuite/tests/driver/bytecode-object/all.T ===================================== @@ -26,3 +26,4 @@ test('bytecode_object22', bytecode_opts, makefile_test, ['bytecode_object22']) test('bytecode_object23', bytecode_opts, makefile_test, ['bytecode_object23']) test('bytecode_object24', bytecode_opts + [copy_files], makefile_test, ['bytecode_object24']) test('bytecode_object25', [bytecode_opts, req_interp, extra_files(['BytecodeForeign.hs', 'BytecodeForeign.c'])], makefile_test, ['bytecode_object25']) +test('bytecode_object26', [bytecode_opts], makefile_test, ['bytecode_object26']) ===================================== testsuite/tests/plugins/Makefile ===================================== @@ -238,3 +238,10 @@ test-late-plugin: .PHONY: T21730 T21730: "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -v0 T21730.hs -package-db T21730-plugin/pkg.T21730-plugin/local.package.conf + +# Test that .dyn_o files are accepted as valid object files on the command line +# without producing "ignoring unrecognised input" warnings (#24486) +.PHONY: T24486 +T24486: + "$(TEST_HC)" $(TEST_HC_OPTS) -v0 -c T24486_Helper.hs -osuf dyn_o + "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -v0 T24486.hs T24486_Helper.dyn_o -package-db T24486-plugin/pkg.T24486-plugin/local.package.conf -fplugin T24486_Plugin -plugin-package T24486-plugin ===================================== testsuite/tests/plugins/T24486-plugin/Makefile ===================================== @@ -0,0 +1,18 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +clean.%: + rm -rf pkg.$* + +HERE := $(abspath .) +$(eval $(call canonicalise,HERE)) + +package.%: + $(MAKE) -s --no-print-directory clean.$* + mkdir pkg.$* + "$(TEST_HC)" -outputdir pkg.$* --make -v0 -o pkg.$*/setup Setup.hs + "$(GHC_PKG)" init pkg.$*/local.package.conf + pkg.$*/setup configure --distdir pkg.$*/dist -v0 $(CABAL_PLUGIN_BUILD) --prefix="$(HERE)/pkg.$*/install" --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=pkg.$*/local.package.conf $(if $(findstring YES,$(HAVE_PROFILING)), --enable-library-profiling) + pkg.$*/setup build --distdir pkg.$*/dist -v0 + pkg.$*/setup install --distdir pkg.$*/dist -v0 ===================================== testsuite/tests/plugins/T24486-plugin/Setup.hs ===================================== @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain ===================================== testsuite/tests/plugins/T24486-plugin/T24486-plugin.cabal ===================================== @@ -0,0 +1,9 @@ +Name: T24486-plugin +Version: 0.1 +Synopsis: For testing +Cabal-Version: >= 1.2 +Build-Type: Simple + +Library + Build-Depends: base, ghc + Exposed-Modules: T24486_Plugin ===================================== testsuite/tests/plugins/T24486-plugin/T24486_Plugin.hs ===================================== @@ -0,0 +1,6 @@ +module T24486_Plugin (plugin) where + +import GHC.Plugins + +plugin :: Plugin +plugin = defaultPlugin ===================================== testsuite/tests/plugins/T24486.hs ===================================== @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = return () ===================================== testsuite/tests/plugins/T24486_Helper.hs ===================================== @@ -0,0 +1,4 @@ +module T24486_Helper where + +helper :: Int +helper = 42 ===================================== testsuite/tests/plugins/all.T ===================================== @@ -395,3 +395,10 @@ test('T21730', pre_cmd('$MAKE -s --no-print-directory -C T21730-plugin package.T21730-plugin TOP={top}') ], makefile_test, []) + +test('T24486', + [extra_files(['T24486-plugin/', 'T24486_Helper.hs']), + when(opsys('mingw32'), skip), + pre_cmd('$MAKE -s --no-print-directory -C T24486-plugin package.T24486-plugin TOP={top}') + ], + makefile_test, []) ===================================== testsuite/tests/runghc/Makefile ===================================== @@ -23,6 +23,11 @@ T11247: -'$(RUNGHC)' foo. -'$(RUNGHC)' foo.bar +# runghc should honour -osuf for dependencies too (#16145). +T16145: + '$(RUNGHC)' -- -fobject-code -osuf=hs.o T16145 + printf '%s\n' *.hi *.o *.hs | LC_ALL=C sort + T17171a: '$(RUNGHC)' --ghc-arg=-Wall T17171a.hs T17171b: ===================================== testsuite/tests/runghc/T16145.hs ===================================== @@ -0,0 +1,5 @@ +module T16145 where + +import T16145_aux + +main = g ===================================== testsuite/tests/runghc/T16145.stdout ===================================== @@ -0,0 +1,6 @@ +T16145.hi +T16145.hs +T16145.hs.o +T16145_aux.hi +T16145_aux.hs +T16145_aux.hs.o ===================================== testsuite/tests/runghc/T16145_aux.hs ===================================== @@ -0,0 +1,4 @@ +module T16145_aux where + +g :: IO () +g = return () ===================================== testsuite/tests/runghc/all.T ===================================== @@ -4,6 +4,8 @@ test('T8601', req_interp, makefile_test, []) test('T11247', [req_interp, expect_broken(11247)], makefile_test, []) +test('T16145', req_interp, makefile_test, []) + test('T6132', [], compile, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ebb20c2c67aca93e4ced2498271f240... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ebb20c2c67aca93e4ced2498271f240... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)