From 29614643e41b6d21e9fdb5d57bfab0d6319bea5b Mon Sep 17 00:00:00 2001 From: FractalFir Date: Tue, 8 Jul 2025 21:36:05 +0200 Subject: [PATCH] Change the implementation of supports_parallel to signal tha cg_gcc is not thread safe. --- src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 45e81aea551..790e32a4bc6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -289,6 +289,10 @@ fn new_context<'gcc, 'tcx>(tcx: TyCtxt<'tcx>) -> Context<'gcc> { } impl ExtraBackendMethods for GccCodegenBackend { + fn supports_parallel(&self) -> bool { + false + } + fn codegen_allocator( &self, tcx: TyCtxt<'_>, @@ -357,8 +361,7 @@ impl Deref for SyncContext { } unsafe impl Send for SyncContext {} -// FIXME(antoyo): that shouldn't be Sync. Parallel compilation is currently disabled with "-Zno-parallel-llvm". -// TODO: disable it here by returning false in CodegenBackend::supports_parallel(). +// FIXME(antoyo): that shouldn't be Sync. Parallel compilation is currently disabled with "CodegenBackend::supports_parallel()". unsafe impl Sync for SyncContext {} impl WriteBackendMethods for GccCodegenBackend {