From 46902fbd37aaaadabefd45b923aa3d3a5b0e973a Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Tue, 4 Jun 2024 13:19:31 +0900 Subject: [PATCH] WIP --- chibild/chibild.core/CilLinker.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/chibild/chibild.core/CilLinker.cs b/chibild/chibild.core/CilLinker.cs index 14cedb4..8a94197 100644 --- a/chibild/chibild.core/CilLinker.cs +++ b/chibild/chibild.core/CilLinker.cs @@ -62,6 +62,7 @@ private bool TryLoadInputReferences( string[] libraryReferenceBasePaths, string[] assemblyReferenceBasePaths, InputReference[] inputReferences, + string? injectToAssemblyPath, bool isLocationOriginSource, out InputFragment[] fragments) { @@ -144,6 +145,7 @@ when Path.GetExtension(relativePath) == ".a": // Asssembly: case LibraryPathReference(var relativePath): + var isInjectAssembly = (index == 0) && (relativePath == injectToAssemblyPath); var libraryFilePath = Path.Combine(baseInputPath, relativePath); if (!File.Exists(libraryFilePath)) { @@ -157,11 +159,8 @@ when Path.GetExtension(relativePath) == ".a": this.logger, baseInputPath, relativePath, - // Create this assembly specific resolver, - // because shared resolver can not resolve on multi-threaded context. - // At the cost of having to load it again later in the primary assembly resolver. this.CreateAssemblyResolver( - ReadingMode.Immediate, + ReadingMode.Deferred, assemblyReferenceBasePaths)), }; break; @@ -194,11 +193,8 @@ when Path.GetExtension(relativePath) == ".a": this.logger, foundEntry.basePath, foundEntry.fileName, - // Create this assembly specific resolver, - // because shared resolver can not resolve on multi-threaded context. - // At the cost of having to load it again later in the primary assembly resolver. this.CreateAssemblyResolver( - ReadingMode.Immediate, + ReadingMode.Deferred, assemblyReferenceBasePaths)), }; } @@ -326,6 +322,7 @@ injectToAssemblyPath is { } injectPath ? options.LibraryReferenceBasePaths, assemblyReferenceBasePaths, totalInputReferences, + injectToAssemblyPath, produceDebuggingInformation, out var loadedFragments)) {