Fix linking flags used during ILCompiler build#17043
Conversation
Linker flags set in src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets in SetupOSSpecificProps do not consider platform specifics, which are set in toolchain.cmake. At the same time, LocateNativeCompiler in ./eng/toolAot.targets does similar job to get linker, and now GetCrossToolchainInfoAot in ./eng/toolAot.targets does same to get linker flags based on toolchain.cmake. toolchain.cmake is already used this way in src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj
|
Can you show the error and which runtime commit you were trying with (latest main in runtime should have all the changes which we have here)? This is exactly what we had before, so I'm not sure how is it broken.
That PR moved the code to a shared location without changing the logic except for include semantics. It's unclear what has it broken that we are fixing here. |
Sorry for confusion, this is not a newly introduced issue. dotnet/dotnet#6802 is related only in sense that it moves similar logic to eng/common/native/LocateNativeCompiler.targets, and changes should get here and not in runtime repo. Actually, this issue is present in release/10.0 branch of runtime too. Error below happens during tizen cross build, because tizen rootfs requires additional linker flags, which are specified in toolchain.cmake. |
|
Thanks for the clarification.
The linker flags in |
Yes
There would be some duplication in toolchain.cmake and src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets. Maybe Another problem I see with this is that |
|
We already have duplication in BuildIntegration, because we ship it in nuget package for PublishAot, that's why we were very careful about depending on anything outside the directory (except for LocateNativeCompiler for .NET CI/CD minimal overrides).
We can sub-classify Tizen like this https://github.com/dotnet/runtime/blob/5e3dadb4a2b39e6e32127ecd0038854a338773e7/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets#L63. |
|
Thanks for explanation, I'll update based on your suggestions |
|
Closing this in favor of dotnet/runtime#129844 |
Linker flags set in src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets in SetupOSSpecificProps do not consider platform specifics, which are set in toolchain.cmake. At the same time, LocateNativeCompiler in ./eng/toolAot.targets does similar job to get linker, and now GetCrossToolchainInfoAot in ./eng/toolAot.targets does same to get linker flags based on toolchain.cmake.
toolchain.cmake is already used this way in src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj
Related PR: dotnet/dotnet#6802