Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 18d68a70 by ARATA Mizuki at 2025-10-08T00:46:36-04:00 T22033 is only relevant if the word size is 64-bit Fixes #25497 - - - - - 0bb9836d by Ben Gamari at 2025-10-08T00:46:38-04:00 rts/posix: Enforce iteration limit on heap reservation logic Previously we could loop indefinitely when attempting to get an address space reservation for our heap. Limit the logic to 8 iterations to ensure we instead issue a reasonable error message. Addresses #26151. - - - - - 5a4a02d6 by Ben Gamari at 2025-10-08T00:46:39-04:00 rts/posix: Hold on to low reservations when reserving heap Previously when the OS gave us an address space reservation in low memory we would immediately release it and try again. However, on some platforms this meant that we would get the same allocation again in the next iteration (since mmap's `hint` argument is just that, a hint). Instead we now hold on to low reservations until we have found a suitable heap reservation. Fixes #26151. - - - - - cf643449 by Sven Tennie at 2025-10-08T00:46:39-04:00 Build terminfo only in upper stages in cross-builds (#26288) Currently, there's no way to provide library paths for [n]curses for both - build and target - in cross-builds. As stage0 is only used to build upper stages, it should be fine to build terminfo only for them. This re-enables building cross-compilers with terminfo. - - - - - b6bbcd37 by Julian Ospald at 2025-10-08T00:46:45-04:00 ghc-toolchain: Drop `ld.gold` from merge object command It's deprecated. Also see #25716 - - - - - 6 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - hadrian/src/Settings/Default.hs - rts/posix/OSMem.c - testsuite/tests/llvm/should_run/all.T - utils/ghc-toolchain/src/GHC/Toolchain/Tools/MergeObjs.hs Changes: ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -489,7 +489,6 @@ alpineVariables arch = mconcat $ [ mconcat [ brokenTest test "#25498" | test <- ["simd009", "T25169"] ] | I386 <- [arch] ] ++ - [ brokenTest "T22033" "#25497" | I386 <- [arch] ] ++ [ -- Bootstrap compiler has incorrectly configured target triple #25200 "CONFIGURE_ARGS" =: "--enable-ignore-build-platform-mismatch --build=aarch64-unknown-linux --host=aarch64-unknown-linux --target=aarch64-unknown-linux" | AArch64 <- [arch] ===================================== .gitlab/jobs.yaml ===================================== @@ -532,7 +532,7 @@ "variables": { "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-i386-linux-alpine3_22-validate", - "BROKEN_TESTS": "encoding004 T10458 simd009 T25169 T22033", + "BROKEN_TESTS": "encoding004 T10458 simd009 T25169", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", @@ -1203,7 +1203,7 @@ "variables": { "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-i386-linux-alpine3_22-validate", - "BROKEN_TESTS": "encoding004 T10458 simd009 T25169 T22033", + "BROKEN_TESTS": "encoding004 T10458 simd009 T25169", "BUILD_FLAVOUR": "validate", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", "INSTALL_CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", @@ -4017,7 +4017,7 @@ "variables": { "BIGNUM_BACKEND": "gmp", "BIN_DIST_NAME": "ghc-i386-linux-alpine3_22-release+no_split_sections", - "BROKEN_TESTS": "encoding004 T10458 simd009 T25169 T22033", + "BROKEN_TESTS": "encoding004 T10458 simd009 T25169", "BUILD_FLAVOUR": "release+no_split_sections", "CONFIGURE_ARGS": "--disable-ld-override --enable-strict-ghc-toolchain-check", "IGNORE_PERF_FAILURES": "all", ===================================== hadrian/src/Settings/Default.hs ===================================== @@ -80,7 +80,6 @@ stageBootPackages = return stage0Packages :: Action [Package] stage0Packages = do cross <- flag CrossCompiling - haveCurses <- any (/= "") <$> traverse setting [ CursesIncludeDir, CursesLibDir ] return $ [ cabalSyntax , cabal , compiler @@ -116,7 +115,11 @@ stage0Packages = do -- that confused Hadrian, so we must make those a stage0 package as well. -- Once we drop `Win32`/`unix` it should be possible to drop those too. ] - ++ [ terminfo | not windowsHost, (not cross || haveCurses) ] + -- Currently, we have no way to provide paths to [n]curses libs for + -- both - build and target - in cross builds. Thus, we only build it + -- for upper stages. As we only use stage0 to build upper stages, + -- this should be fine. + ++ [ terminfo | not windowsHost, not cross ] ++ [ timeout | windowsHost ] -- | Packages built in 'Stage1' by default. You can change this in "UserSettings". @@ -136,6 +139,7 @@ stage1Packages = do libraries0 <- filter good_stage0_package <$> stage0Packages cross <- flag CrossCompiling winTarget <- isWinTarget + haveCurses <- any (/= "") <$> traverse setting [ CursesIncludeDir, CursesLibDir ] let when c xs = if c then xs else mempty @@ -185,6 +189,10 @@ stage1Packages = do [ -- See Note [Hadrian's ghci-wrapper package] ghciWrapper ] + , when (cross && haveCurses) + [ + terminfo + ] ] -- | Packages built in 'Stage2' by default. You can change this in "UserSettings". ===================================== rts/posix/OSMem.c ===================================== @@ -585,8 +585,14 @@ void *osReserveHeapMemory(void *startAddressPtr, W_ *len) } #endif + const int MAX_ATTEMPTS = 256; + void *bad_allocs[MAX_ATTEMPTS]; + size_t bad_alloc_lens[MAX_ATTEMPTS]; + memset(bad_allocs, 0, sizeof(void*) * MAX_ATTEMPTS); + memset(bad_alloc_lens, 0, sizeof(size_t) * MAX_ATTEMPTS); + attempt = 0; - while (1) { + while (attempt < MAX_ATTEMPTS) { *len &= ~MBLOCK_MASK; if (*len < MBLOCK_SIZE) { @@ -611,18 +617,35 @@ void *osReserveHeapMemory(void *startAddressPtr, W_ *len) } else if ((W_)at >= minimumAddress) { // Success! We were given a block of memory starting above the 8 GB // mark, which is what we were looking for. - break; } else { // We got addressing space but it wasn't above the 8GB mark. - // Try again. - if (munmap(at, *len) < 0) { - sysErrorBelch("unable to release reserved heap"); + // Free any portion *above* 8GB and hang on to the rest to increase + // the likelihood that we get a suitable allocation next iteration. + uintptr_t end = (W_) at + *len; + bad_allocs[attempt] = at; + if (end > minimumAddress) { + if (munmap((void *) minimumAddress, end - minimumAddress) < 0) { + sysErrorBelch("unable to release high portion of low memory reservation"); + } + bad_alloc_lens[attempt] = minimumAddress - (W_) at; + } else { + bad_alloc_lens[attempt] = *len; } } attempt++; } + for (int i=0; i < MAX_ATTEMPTS; i++) { + if (bad_allocs[i] != NULL && munmap(bad_allocs[i], bad_alloc_lens[i]) < 0) { + sysErrorBelch("unable to release reserved heap"); + } + } + + if (at == NULL) { + sysErrorBelch("failed to reserve heap memory"); + } + return at; } ===================================== testsuite/tests/llvm/should_run/all.T ===================================== @@ -14,7 +14,7 @@ def ignore_llvm_and_vortex( msg ): test('T25770', [normal, normalise_errmsg_fun(ignore_llvm_and_vortex)], compile_and_run, ['']) test('T22487', [normal, normalise_errmsg_fun(ignore_llvm_and_vortex)], compile_and_run, ['']) -test('T22033', [normal, normalise_errmsg_fun(ignore_llvm_and_vortex)], compile_and_run, ['']) +test('T22033', [normal, unless(wordsize(64), skip), normalise_errmsg_fun(ignore_llvm_and_vortex)], compile_and_run, ['']) test('T25730', [req_c, unless(arch('x86_64'), skip), normalise_errmsg_fun(ignore_llvm_and_vortex)], compile_and_run, ['T25730C.c']) # T25730C.c contains Intel instrinsics, so only run this test on x86 test('T20645', [normal, normalise_errmsg_fun(ignore_llvm_and_vortex), when(have_llvm(), extra_ways(["optllvm"]))], compile_and_run, ['']) ===================================== utils/ghc-toolchain/src/GHC/Toolchain/Tools/MergeObjs.hs ===================================== @@ -22,7 +22,7 @@ data MergeObjs = MergeObjs { mergeObjsProgram :: Program findMergeObjs :: ProgOpt -> Cc -> CcLink -> Nm -> M MergeObjs findMergeObjs progOpt cc ccLink nm = checking "for linker for merging objects" $ do - prog <- findProgram "linker for merging objects" progOpt ["ld.gold", "ld"] + prog <- findProgram "linker for merging objects" progOpt ["ld"] let mo = prog & _prgFlags %++ "-r" checkMergingWorks cc nm mo checkForGoldT22266 cc ccLink mo View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4c29333b7ce6e90b7849764c0546b8c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4c29333b7ce6e90b7849764c0546b8c... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)