-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NativeAOT][8.0] Use ld_classic in ILC build and in build integration #97856
Conversation
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
I think we should do it. Xamarin workloads in .NET 8 already force the old linker, and the new linker appears quite buggy. We can try to workaround/fix things for .NET 9 and backport them if Apple decides to ditch the old linker. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OSX builds are failing with ld: library not found for -ld_classic
.
Probably the code needs to test if XCode is 15 or later? |
Possibly, and use |
src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
Outdated
Show resolved
Hide resolved
@@ -79,6 +79,7 @@ | |||
|
|||
<ItemGroup Condition="'$(NativeAotSupported)' == 'true'"> | |||
<CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_hostOS)' != 'windows' and '$(_IsApplePlatform)' != 'true'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" /> | |||
<CustomLinkerArg Condition="'$(_IsApplePlatform)' == 'true'" Include="-ld_classic" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC it uses the released package, not the one we just built, so it is necessary.
Is there a way to check for that? |
We added major version detection for lld (for linker script): runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets Lines 202 to 208 in 034d9f1
exact same regex returns |
src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo feedback.
@VSadov Could you please get it approved for servicing once ready?
Also, we will want to apply it to main as well: #98117 (comment)
Friendly reminder that Monday February 12th is the Code Complete deadline for the March Release. Please make sure to address the feedback and then send the email to Tactics requesting approval. |
…e.Unix.targets PR feedback Co-authored-by: Jan Kotas <jkotas@microsoft.com>
I've re-validated that the fix still works after the PR feedback changes and that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved. we could consider this a tell mode change to accommodate a coming xcode change
bb540a8
into
dotnet:release/8.0-staging
Thanks!! |
…dotnet#97856) * use ld_classic in ILC build and in build integration * PR feedback * Maybe fix the build for non-apple * Update src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets PR feedback Co-authored-by: Jan Kotas <jkotas@microsoft.com> --------- Co-authored-by: Jan Kotas <jkotas@microsoft.com>
This pool is only available internally for now, so let's use it! * Add workaround from #97856 to use classic linker on macos
Fixes: #97745
Customer Impact
Programs produced in an environment running XCode version 15 or higher will experience various crashes upon starting.
Also, if a build machine is upgraded to xcode 15+ it can't complete the build successfully as ILC, being a NativeAOT component, will not be runnable, thus stages such as building tests would fail.
Analysis
XCode 15 has introduced a new linker that contains a number of incompatibilities. Some of those incompatibilities may be unintentional and may eventually be fixed. It seems possible that point releases (i.e 15.0 vs. 15.2) have different set of issues.
For the time being there is a way to force the use of the old (aka "classic") linker and get around incompatibilities.
While we can chase incompatibilities and adapt to them in the active development branch, in 8.0 branch it makes more sense to opt for "classic" behavior.
Testing
Manual testing locally with XCode 15.2 and regular lab run with XCode 14 that is still used by the lab.
Risk
Low. This change conditionally reintroduces preexisting linker behavior.
There is a risk that at some point "classic" linker will no longer be supported.
It will likely be far enough in the future that the "prime" linker becomes more stable and the runtime/compiler could be adapted to work with it at that time.