Skip to content

Conversation

@jakobbotsch
Copy link
Member

Introduce a CorInfoReloc enum and use it exclusively to communicate relocation types between the EE and JIT. Translate it in crossgen2/ILC to the file-format relocation type when necessary.

Fix #121878

Introduce a `CorInfoReloc` enum and use it exclusively to communicate
relocation types between the EE and JIT. Translate it in crossgen2/ILC
to the file-format relocation type when necessary.
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 24, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@kg
Copy link
Member

kg commented Nov 24, 2025

LGTM

@am11
Copy link
Member

am11 commented Nov 24, 2025

@jakobbotsch, I added a smoke test in #121895 to see whether or not it works on community platforms. I tried merging this PR branch and commenting out [RuntimeAsyncMethodGeneration(false)] lines added in that PR, src/tests/build.sh is failing on osx-arm64:

$ ./build.sh clr+libs
$ src/tests/build.sh -nativeaot -tree:nativeaot -p:TasksConfiguration=Debug -p:LibrariesConfiguration=Debug -keepnativesymbols

    Illegal text-relocations:
      text-relocation in '_S_P_CoreLib_System_Threading_Tasks_Task__<AsyncCallable>S_P_CoreLib_System_Threading_Tasks_Task__get_CompletedTask'+0x180 (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_S_P_CoreLib_System_Threading_Tasks_Task__<AsyncCallable>S_P_CoreLib_System_Threading_Tasks_Task__get_CompletedTask'
      text-relocation in '_S_P_CoreLib_System_Threading_Tasks_Task__<AsyncCallable>S_P_CoreLib_System_Threading_Tasks_Task__get_CompletedTask'+0x178 (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_Internal_CompilerGenerated__Module___<Resume>S_P_CoreLib_System_Threading_Tasks_Task__<AsyncCallable>S_P_CoreLib_System_Threading_Tasks_Task__get_CompletedTask'
      text-relocation in '_fram1_UnitTests_TaskReturningAsyncTest__<AsyncCallable>UnitTests_TaskReturningAsyncTest__SimpleAsyncMethod'+0x34 (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_UnitTests_TaskReturningAsyncTest__<AsyncCallable>UnitTests_TaskReturningAsyncTest__SimpleAsyncMethod'
      text-relocation in '_fram1_UnitTests_TaskReturningAsyncTest__<AsyncCallable>UnitTests_TaskReturningAsyncTest__SimpleAsyncMethod'+0x2C (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_Internal_CompilerGenerated__Module___<Resume>UnitTests_TaskReturningAsyncTest__<AsyncCallable>UnitTests_TaskReturningAsyncTest__SimpleAsyncMethod'
      text-relocation in '_fram1_UnitTests_ValueTaskReturningAsyncTest__<AsyncCallable>UnitTests_ValueTaskReturningAsyncTest__SimpleValueTaskAsync'+0x34 (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_UnitTests_ValueTaskReturningAsyncTest__<AsyncCallable>UnitTests_ValueTaskReturningAsyncTest__SimpleValueTaskAsync'
      text-relocation in '_fram1_UnitTests_ValueTaskReturningAsyncTest__<AsyncCallable>UnitTests_ValueTaskReturningAsyncTest__SimpleValueTaskAsync'+0x2C (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_Internal_CompilerGenerated__Module___<Resume>UnitTests_ValueTaskReturningAsyncTest__<AsyncCallable>UnitTests_ValueTaskReturningAsyncTest__SimpleValueTaskAsync'
      text-relocation in '_fram1_UnitTests_TaskWithResultTest__<AsyncCallable>UnitTests_TaskWithResultTest__ComputeAsync'+0x34 (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_UnitTests_TaskWithResultTest__<AsyncCallable>UnitTests_TaskWithResultTest__ComputeAsync'
      text-relocation in '_fram1_UnitTests_TaskWithResultTest__<AsyncCallable>UnitTests_TaskWithResultTest__ComputeAsync'+0x2C (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_Internal_CompilerGenerated__Module___<Resume>UnitTests_TaskWithResultTest__<AsyncCallable>UnitTests_TaskWithResultTest__ComputeAsync'
      text-relocation in '_fram1_UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__GetMessageAsync'+0x34 (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__GetMessageAsync'
      text-relocation in '_fram1_UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__GetMessageAsync'+0x2C (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_Internal_CompilerGenerated__Module___<Resume>UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__GetMessageAsync'
      text-relocation in '_fram1_UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__CombineAsync'+0x48 (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__CombineAsync'
      text-relocation in '_fram1_UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__CombineAsync'+0x40 (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_Internal_CompilerGenerated__Module___<Resume>UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__CombineAsync'
      text-relocation in '_fram1_UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__CombineAsync'+0x38 (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__CombineAsync'
      text-relocation in '_fram1_UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__CombineAsync'+0x30 (/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o) to '_Internal_CompilerGenerated__Module___<Resume>UnitTests_AwaitCompletedTaskTest__<AsyncCallable>UnitTests_AwaitCompletedTaskTest__CombineAsync'
    ld: Found illegal text-relocations
clang : error : linker command failed with exit code 1 (use -v to see invocation) [/Users/adeel/projects/runtime5/src/tests/build.proj]
/Users/adeel/projects/runtime5/artifacts/bin/coreclr/osx.arm64.Debug/build/Microsoft.NETCore.Native.targets(389,5): error MSB3073: The command ""/usr/bin/clang" "/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.o" -o "/Users/adeel/projects/runtime5/artifacts/tests/coreclr/osx.arm64.Debug/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests" -exported_symbols_list "/Users/adeel/projects/runtime5/artifacts/tests/coreclr/obj/osx.arm64.Debug/Managed/nativeaot/SmokeTests/UnitTests/UnitTests/native/UnitTests.exports" -Wl,-dead_strip -Wl,-rpath,'@executable_path/..' -gz=zlib /Users/adeel/projects/runtime5/artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Debug/runtimes/osx-arm64/native/libSystem.Native.a /Users/adeel/projects/runtime5/artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Debug/runtimes/osx-arm64/native/libSystem.Globalization.Native.a /Users/adeel/projects/runtime5/artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Debug/runtimes/osx-arm64/native/libSystem.IO.Compression.Native.a /Users/adeel/projects/runtime5/artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Debug/runtimes/osx-arm64/native/libSystem.Net.Security.Native.a /Users/adeel/projects/runtime5/artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Debug/runtimes/osx-arm64/native/libSystem.Security.Cryptography.Native.Apple.a /Users/adeel/projects/runtime5/artifacts/bin/coreclr/osx.arm64.Debug/aotsdk/libbootstrapper.o /Users/adeel/projects/runtime5/artifacts/bin/coreclr/osx.arm64.Debug/aotsdk/libRuntime.WorkstationGC.a /Users/adeel/projects/runtime5/artifacts/bin/coreclr/osx.arm64.Debug/aotsdk/libeventpipe-disabled.a /Users/adeel/projects/runtime5/artifacts/bin/coreclr/osx.arm64.Debug/aotsdk/libRuntime.VxsortDisabled.a /Users/adeel/projects/runtime5/artifacts/bin/coreclr/osx.arm64.Debug/aotsdk/libstandalonegc-disabled.a /Users/adeel/projects/runtime5/artifacts/bin/coreclr/osx.arm64.Debug/aotsdk/libaotminipal.a /Users/adeel/projects/runtime5/artifacts/bin/coreclr/osx.arm64.Debug/aotsdk/libstdc++compat.a /Users/adeel/projects/runtime5/artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Debug/runtimes/osx-arm64/native/libz.a /Users/adeel/projects/runtime5/artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Debug/runtimes/osx-arm64/native/libbrotlienc.a /Users/adeel/projects/runtime5/artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Debug/runtimes/osx-arm64/native/libbrotlidec.a /Users/adeel/projects/runtime5/artifacts/bin/microsoft.netcore.app.runtime.osx-arm64/Debug/runtimes/osx-arm64/native/libbrotlicommon.a --target=arm64-apple-macos12.0 -g -ldl -lobjc -lswiftCore -lswiftFoundation -licucore -lm -L/usr/lib/swift -framework CoreFoundation -framework CryptoKit -framework Foundation -framework Network -framework Security -framework GSS" exited with code 1. [/Users/adeel/projects/runtime5/src/tests/nativeaot/SmokeTests/UnitTests/UnitTests.csproj] [/Users/adeel/projects/runtime5/src/tests/build.proj]

without your PR, the error/callstack is same as: #121878 (comment).

@jakobbotsch
Copy link
Member Author

That looks like #121871. It needs a separate change.

@jakobbotsch jakobbotsch marked this pull request as ready for review November 24, 2025 19:51
Copilot AI review requested due to automatic review settings November 24, 2025 19:51
Copilot finished reviewing on behalf of jakobbotsch November 24, 2025 19:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 35 out of 35 changed files in this pull request and generated no comments.

@jakobbotsch
Copy link
Member Author

PTAL @dotnet/jit-contrib @jkotas

@jakobbotsch jakobbotsch requested review from a team and jkotas November 24, 2025 20:24
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The additional cleanup can be done in separate PR

@jakobbotsch jakobbotsch merged commit bd364ce into dotnet:main Nov 25, 2025
106 of 107 checks passed
@jakobbotsch jakobbotsch deleted the fix-relocs branch November 25, 2025 10:41
@jakobbotsch
Copy link
Member Author

cc @tomeksowi -- #119203 will need some changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relocation problem on ARM64 Linux

4 participants