diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 3c997799362abd..9bbc58b0ccaff9 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -148,8 +148,8 @@ The .NET Foundation licenses this file to you under the MIT license. - - + + $(IlcFrameworkNativePath)lib%(Identity).a @@ -180,7 +180,7 @@ The .NET Foundation licenses this file to you under the MIT license. - + @@ -193,7 +193,7 @@ The .NET Foundation licenses this file to you under the MIT license. - + diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Windows.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Windows.targets index 8639c24343b883..eca4646c95b658 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Windows.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Windows.targets @@ -58,7 +58,7 @@ The .NET Foundation licenses this file to you under the MIT license. - + $(IlcSdkPath)%(Identity).Aot$(LibrarySuffix) diff --git a/src/coreclr/tools/aot/ILCompiler/ConfigurablePInvokePolicy.cs b/src/coreclr/tools/aot/ILCompiler/ConfigurablePInvokePolicy.cs index 27d6108eb70e9e..ac6e0a66934ac7 100644 --- a/src/coreclr/tools/aot/ILCompiler/ConfigurablePInvokePolicy.cs +++ b/src/coreclr/tools/aot/ILCompiler/ConfigurablePInvokePolicy.cs @@ -92,9 +92,16 @@ private IEnumerable ModuleNameVariations(string name) else { string suffix = _target.IsApplePlatform ? ".dylib" : ".so"; + bool hasSharedLibraryExtension = name.EndsWith(suffix, StringComparison.Ordinal); + const string LibPrefix = "lib"; + bool hasLibPrefix = name.StartsWith(LibPrefix, StringComparison.Ordinal); - if (name.EndsWith(suffix, StringComparison.Ordinal)) + if (hasSharedLibraryExtension) yield return name.Substring(0, name.Length - suffix.Length); + if (hasLibPrefix) + yield return name.Substring(LibPrefix.Length); + if (hasLibPrefix && hasSharedLibraryExtension) + yield return name.Substring(LibPrefix.Length, name.Length - suffix.Length - LibPrefix.Length); } }