From a8f60533c63abdf7a6bafa0508da7f016fd6bc2c Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 5 Apr 2024 17:33:14 +0200 Subject: [PATCH 01/31] Enable linux_arm64 platform in extra-platforms and runtime-llvm pipelines --- .../extra-platforms/runtime-extra-platforms-other.yml | 3 +-- eng/pipelines/runtime-llvm.yml | 9 +++------ src/tests/build.proj | 10 +++++++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-other.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-other.yml index e47cb4996cc704..7c7a9aca40a9c0 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-other.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-other.yml @@ -120,8 +120,7 @@ jobs: runtimeFlavor: mono platforms: - linux_x64 - # Tracking issue: https://github.com/dotnet/runtime/issues/90427 - # linux_arm64 + - linux_arm64 variables: - name: timeoutPerTestInMinutes value: 60 diff --git a/eng/pipelines/runtime-llvm.yml b/eng/pipelines/runtime-llvm.yml index ee96cc2a04f555..893ea18f1be16c 100644 --- a/eng/pipelines/runtime-llvm.yml +++ b/eng/pipelines/runtime-llvm.yml @@ -133,8 +133,7 @@ extends: runtimeFlavor: mono platforms: - linux_x64 - # Disabled pending outcome of https://github.com/dotnet/runtime/issues/60234 investigation - #- linux_arm64 + - linux_arm64 variables: - name: timeoutPerTestInMinutes value: 60 @@ -174,8 +173,7 @@ extends: runtimeFlavor: mono platforms: - linux_x64 - # Tracking issue: https://github.com/dotnet/runtime/issues/90427 - # - linux_arm64 + - linux_arm64 variables: - name: timeoutPerTestInMinutes value: 60 @@ -221,8 +219,7 @@ extends: runtimeFlavor: mono platforms: - linux_x64 - # Tracking issue: https://github.com/dotnet/runtime/issues/90427 - # - linux_arm64 + - linux_arm64 variables: - name: timeoutPerTestInMinutes value: 60 diff --git a/src/tests/build.proj b/src/tests/build.proj index 7f2a0b6b38af5b..8e587719fa3c96 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -153,12 +153,16 @@ - + + -target aarch64-unknown-linux-gnu + --sysroot $(ROOTFS_DIR) + + - + - + From 633c73ac8cbd36cf2f471269eff1f65b902d7e68 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 5 Apr 2024 17:38:07 +0200 Subject: [PATCH 02/31] Remove unused LLVMAot test build configuration --- eng/pipelines/common/platform-matrix.yml | 20 ------------------- .../templates/pipeline-with-resources.yml | 5 +---- .../build-runtime-tests-and-send-to-helix.yml | 7 ------- .../runtime-extra-platforms-other.yml | 1 - eng/pipelines/runtime-llvm.yml | 3 --- eng/pipelines/runtime.yml | 1 - 6 files changed, 1 insertion(+), 36 deletions(-) diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 7245e521680464..e6c039fce2eec5 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -381,26 +381,6 @@ jobs: helixQueueGroup: ${{ parameters.helixQueueGroup }} ${{ insert }}: ${{ parameters.jobParameters }} -# Mono LLVMAot test build - -- ${{ if containsValue(parameters.platforms, 'linux_x64_llvmaot') }}: - - template: xplat-setup.yml - parameters: - jobTemplate: ${{ parameters.jobTemplate }} - helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} - variables: ${{ parameters.variables }} - osGroup: linux - archType: x64 - targetRid: linux-x64 - platform: linux_x64 - shouldContinueOnError: ${{ parameters.shouldContinueOnError }} - container: linux_x64_llvmaot - jobParameters: - runtimeFlavor: ${{ parameters.runtimeFlavor }} - buildConfig: ${{ parameters.buildConfig }} - helixQueueGroup: ${{ parameters.helixQueueGroup }} - ${{ insert }}: ${{ parameters.jobParameters }} - # Linux s390x - ${{ if containsValue(parameters.platforms, 'linux_s390x') }}: diff --git a/eng/pipelines/common/templates/pipeline-with-resources.yml b/eng/pipelines/common/templates/pipeline-with-resources.yml index 5ae3a3f7a38f56..a0ece3d3dd728a 100644 --- a/eng/pipelines/common/templates/pipeline-with-resources.yml +++ b/eng/pipelines/common/templates/pipeline-with-resources.yml @@ -94,9 +94,6 @@ extends: debian-12-gcc13-amd64: image: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-gcc13-amd64 - linux_x64_llvmaot: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8 - browser_wasm: image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-webassembly-20230913040940-1edc1c6 env: @@ -121,4 +118,4 @@ extends: image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-debpkg rpmpkg: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-fpm \ No newline at end of file + image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-fpm diff --git a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml index b0a2043bbd5710..e890792a26939e 100644 --- a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml +++ b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml @@ -13,7 +13,6 @@ parameters: nativeAotTest: false runtimeFlavor: 'mono' runtimeVariant: 'monointerpreter' - llvmAotStepContainer: '' scenarios: - normal variables: {} @@ -66,22 +65,16 @@ steps: - ${{ if eq(parameters.runtimeVariant, 'llvmaot') }}: - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot mono_aot ${{ parameters.buildConfig }} ${{ parameters.archType }} /p:RuntimeVariant=${{ parameters.runtimeVariant }} displayName: "AOT compile CoreCLR tests" - target: ${{ coalesce(parameters.llvmAotStepContainer, parameters.container) }} - ${{ if in(parameters.runtimeVariant, 'llvmfullaot', 'minifullaot') }}: - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot mono_fullaot ${{ parameters.buildConfig }} ${{ parameters.archType }} /p:RuntimeVariant=${{ parameters.runtimeVariant }} -maxcpucount:1 displayName: "AOT compile CoreCLR tests" - target: ${{ coalesce(parameters.llvmAotStepContainer, parameters.container) }} - ${{ if eq(parameters.archType, 'arm64') }}: - ${{ if eq(parameters.runtimeVariant, 'llvmaot') }}: - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot mono_aot ${{ parameters.buildConfig }} ${{ parameters.archType }} cross /p:RuntimeVariant=${{ parameters.runtimeVariant }} -maxcpucount:2 displayName: "AOT cross-compile CoreCLR tests" - env: - __MonoToolPrefix: aarch64-linux-gnu- - ${{ if in(parameters.runtimeVariant, 'llvmfullaot', 'minifullaot') }}: - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot mono_fullaot ${{ parameters.buildConfig }} ${{ parameters.archType }} cross /p:RuntimeVariant=${{ parameters.runtimeVariant }} -maxcpucount:2 displayName: "AOT cross-compile CoreCLR tests" - env: - __MonoToolPrefix: aarch64-linux-gnu- # Checks the value of the compileOnHelix parameter # and if set invokes libraries pipeline for AOT on Helix diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-other.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-other.yml index 7c7a9aca40a9c0..b93f85015d6197 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-other.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-other.yml @@ -142,7 +142,6 @@ jobs: - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml parameters: creator: dotnet-bot - llvmAotStepContainer: linux_x64 testRunNamePrefixSuffix: Mono_Release extraVariablesTemplates: - template: /eng/pipelines/common/templates/runtimes/test-variables.yml diff --git a/eng/pipelines/runtime-llvm.yml b/eng/pipelines/runtime-llvm.yml index 893ea18f1be16c..45ed2ecaa894b0 100644 --- a/eng/pipelines/runtime-llvm.yml +++ b/eng/pipelines/runtime-llvm.yml @@ -155,7 +155,6 @@ extends: - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml parameters: creator: dotnet-bot - llvmAotStepContainer: linux_x64_llvmaot testRunNamePrefixSuffix: Mono_Release extraVariablesTemplates: - template: /eng/pipelines/common/templates/runtimes/test-variables.yml @@ -195,7 +194,6 @@ extends: - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml parameters: creator: dotnet-bot - llvmAotStepContainer: linux_x64_llvmaot testRunNamePrefixSuffix: Mono_Release testBuildArgs: >- -tree:CoreMangLib -tree:Exceptions -tree:GC -tree:Interop -tree:Loader -tree:Regressions -tree:baseservices @@ -241,7 +239,6 @@ extends: - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml parameters: creator: dotnet-bot - llvmAotStepContainer: linux_x64_llvmaot testRunNamePrefixSuffix: Mono_Release testBuildArgs: -tree:JIT/Intrinsics -tree:JIT/HardwareIntrinsics -tree:JIT/SIMD extraVariablesTemplates: diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 98dc5285250f45..35a14d99996932 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -1589,7 +1589,6 @@ extends: - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml parameters: creator: dotnet-bot - llvmAotStepContainer: linux_x64_llvmaot testRunNamePrefixSuffix: Mono_Release extraVariablesTemplates: - template: /eng/pipelines/common/templates/runtimes/test-variables.yml From 22a5d2a674d2e5aa496593ab7a5897e02c1dae0e Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 5 Apr 2024 18:50:12 +0200 Subject: [PATCH 03/31] Add MonoLibClang parameter to the AOT build on arm64 --- .../templates/runtimes/build-runtime-tests-and-send-to-helix.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml index e890792a26939e..24ac3e9cb88a28 100644 --- a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml +++ b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml @@ -47,6 +47,7 @@ steps: -arch ${{ parameters.archType }} /p:BuildMonoAotCrossCompiler=true /p:BuildMonoAotCrossCompilerOnly=true + /p:MonoLibClang="/usr/local/lib/libclang.so.16" /p:CrossBuild=true displayName: "Build Mono Mini AOT cross compiler" - ${{ else }}: From cbc027c227d0833b48daa5d0715d4fc2058ebe1f Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 8 Apr 2024 10:54:43 +0200 Subject: [PATCH 04/31] Exclude Microsoft.CodeAnalysis.dll to test OOM issue --- src/tests/build.proj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tests/build.proj b/src/tests/build.proj index 8e587719fa3c96..699fcdfdb48ee3 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -126,6 +126,8 @@ + + From 32768af1a5e306a387d09e6c6627fb0292ce0d48 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 8 Apr 2024 10:55:33 +0200 Subject: [PATCH 05/31] Disable failing AOT llvm tests on arm64 --- .../JIT/Methodical/Invoke/25params/25paramMixed_d.ilproj | 4 ++-- .../JIT/Methodical/Invoke/25params/25paramMixed_r.ilproj | 4 ++-- src/tests/JIT/Methodical/VT/callconv/jumper4_r.ilproj | 4 ++-- src/tests/JIT/Methodical/VT/callconv/jumper5_r.ilproj | 4 ++-- src/tests/JIT/Methodical/tailcall/deep_value_d.ilproj | 2 ++ src/tests/JIT/Methodical/tailcall/deep_value_r.ilproj | 2 ++ .../JIT/Regression/JitBlue/GitHub_27678/GitHub_27678.ilproj | 2 ++ .../JIT/Regression/JitBlue/Runtime_80731/Runtime_80731.ilproj | 2 ++ .../JIT/Regression/JitBlue/Runtime_93876/Runtime_93876.csproj | 4 +++- src/tests/JIT/jit64/localloc/call/call05_dynamic.ilproj | 2 ++ src/tests/JIT/jit64/localloc/call/call05_large.ilproj | 2 ++ src/tests/JIT/jit64/localloc/call/call05_small.ilproj | 2 ++ 12 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_d.ilproj b/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_d.ilproj index 42661978da60e8..fe8b1a480f4b6b 100644 --- a/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_d.ilproj +++ b/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_d.ilproj @@ -1,8 +1,8 @@ - - Full + + true diff --git a/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_r.ilproj b/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_r.ilproj index 2b47ea376f8b12..7a897e1c58034f 100644 --- a/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_r.ilproj +++ b/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_r.ilproj @@ -1,9 +1,9 @@ - - PdbOnly False + + true diff --git a/src/tests/JIT/Methodical/VT/callconv/jumper4_r.ilproj b/src/tests/JIT/Methodical/VT/callconv/jumper4_r.ilproj index be684f31b3e949..853a2846756e5d 100644 --- a/src/tests/JIT/Methodical/VT/callconv/jumper4_r.ilproj +++ b/src/tests/JIT/Methodical/VT/callconv/jumper4_r.ilproj @@ -1,8 +1,8 @@ - - PdbOnly + + true diff --git a/src/tests/JIT/Methodical/VT/callconv/jumper5_r.ilproj b/src/tests/JIT/Methodical/VT/callconv/jumper5_r.ilproj index 544cfca18ace0f..34f063e8e6d63b 100644 --- a/src/tests/JIT/Methodical/VT/callconv/jumper5_r.ilproj +++ b/src/tests/JIT/Methodical/VT/callconv/jumper5_r.ilproj @@ -1,8 +1,8 @@ - - PdbOnly + + true diff --git a/src/tests/JIT/Methodical/tailcall/deep_value_d.ilproj b/src/tests/JIT/Methodical/tailcall/deep_value_d.ilproj index 71116295f5c631..f5164fca8eb482 100644 --- a/src/tests/JIT/Methodical/tailcall/deep_value_d.ilproj +++ b/src/tests/JIT/Methodical/tailcall/deep_value_d.ilproj @@ -1,6 +1,8 @@ Full + + true diff --git a/src/tests/JIT/Methodical/tailcall/deep_value_r.ilproj b/src/tests/JIT/Methodical/tailcall/deep_value_r.ilproj index 0e014717498373..e87dfc81593d57 100644 --- a/src/tests/JIT/Methodical/tailcall/deep_value_r.ilproj +++ b/src/tests/JIT/Methodical/tailcall/deep_value_r.ilproj @@ -1,6 +1,8 @@ PdbOnly + + true diff --git a/src/tests/JIT/Regression/JitBlue/GitHub_27678/GitHub_27678.ilproj b/src/tests/JIT/Regression/JitBlue/GitHub_27678/GitHub_27678.ilproj index 4b3a54c1abb8a4..3b9e585f73d2f6 100644 --- a/src/tests/JIT/Regression/JitBlue/GitHub_27678/GitHub_27678.ilproj +++ b/src/tests/JIT/Regression/JitBlue/GitHub_27678/GitHub_27678.ilproj @@ -2,6 +2,8 @@ None True + + true diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_80731/Runtime_80731.ilproj b/src/tests/JIT/Regression/JitBlue/Runtime_80731/Runtime_80731.ilproj index 4b3a54c1abb8a4..3b9e585f73d2f6 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_80731/Runtime_80731.ilproj +++ b/src/tests/JIT/Regression/JitBlue/Runtime_80731/Runtime_80731.ilproj @@ -2,6 +2,8 @@ None True + + true diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_93876/Runtime_93876.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_93876/Runtime_93876.csproj index 15edd99711a1a4..2bebd3c4781096 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_93876/Runtime_93876.csproj +++ b/src/tests/JIT/Regression/JitBlue/Runtime_93876/Runtime_93876.csproj @@ -1,8 +1,10 @@ True + + true - \ No newline at end of file + diff --git a/src/tests/JIT/jit64/localloc/call/call05_dynamic.ilproj b/src/tests/JIT/jit64/localloc/call/call05_dynamic.ilproj index a8540d6f5c6224..9f474264e2392d 100644 --- a/src/tests/JIT/jit64/localloc/call/call05_dynamic.ilproj +++ b/src/tests/JIT/jit64/localloc/call/call05_dynamic.ilproj @@ -2,6 +2,8 @@ PdbOnly True + + true diff --git a/src/tests/JIT/jit64/localloc/call/call05_large.ilproj b/src/tests/JIT/jit64/localloc/call/call05_large.ilproj index cc998b68f90dbb..036de917e452cb 100644 --- a/src/tests/JIT/jit64/localloc/call/call05_large.ilproj +++ b/src/tests/JIT/jit64/localloc/call/call05_large.ilproj @@ -2,6 +2,8 @@ PdbOnly True + + true diff --git a/src/tests/JIT/jit64/localloc/call/call05_small.ilproj b/src/tests/JIT/jit64/localloc/call/call05_small.ilproj index 083cf3973f4e1a..123c33f4e834aa 100644 --- a/src/tests/JIT/jit64/localloc/call/call05_small.ilproj +++ b/src/tests/JIT/jit64/localloc/call/call05_small.ilproj @@ -2,6 +2,8 @@ PdbOnly True + + true From a29b9ab765c30cf781ae238767ac1f7e179788bd Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 8 Apr 2024 13:11:23 +0200 Subject: [PATCH 06/31] Limit maxcpucount to 1 on arm64 --- .../runtimes/build-runtime-tests-and-send-to-helix.yml | 6 +++--- src/tests/Interop/Interop.csproj | 4 +--- src/tests/build.proj | 2 -- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml index 24ac3e9cb88a28..e13a575af85460 100644 --- a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml +++ b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml @@ -64,17 +64,17 @@ steps: - ${{ if eq(parameters.archType, 'x64') }}: - ${{ if eq(parameters.runtimeVariant, 'llvmaot') }}: - - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot mono_aot ${{ parameters.buildConfig }} ${{ parameters.archType }} /p:RuntimeVariant=${{ parameters.runtimeVariant }} + - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot mono_aot ${{ parameters.buildConfig }} ${{ parameters.archType }} /p:RuntimeVariant=${{ parameters.runtimeVariant }} -maxcpucount:1 displayName: "AOT compile CoreCLR tests" - ${{ if in(parameters.runtimeVariant, 'llvmfullaot', 'minifullaot') }}: - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot mono_fullaot ${{ parameters.buildConfig }} ${{ parameters.archType }} /p:RuntimeVariant=${{ parameters.runtimeVariant }} -maxcpucount:1 displayName: "AOT compile CoreCLR tests" - ${{ if eq(parameters.archType, 'arm64') }}: - ${{ if eq(parameters.runtimeVariant, 'llvmaot') }}: - - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot mono_aot ${{ parameters.buildConfig }} ${{ parameters.archType }} cross /p:RuntimeVariant=${{ parameters.runtimeVariant }} -maxcpucount:2 + - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot mono_aot ${{ parameters.buildConfig }} ${{ parameters.archType }} cross /p:RuntimeVariant=${{ parameters.runtimeVariant }} -maxcpucount:1 displayName: "AOT cross-compile CoreCLR tests" - ${{ if in(parameters.runtimeVariant, 'llvmfullaot', 'minifullaot') }}: - - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot mono_fullaot ${{ parameters.buildConfig }} ${{ parameters.archType }} cross /p:RuntimeVariant=${{ parameters.runtimeVariant }} -maxcpucount:2 + - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(logRootNameArg)MonoAot mono_fullaot ${{ parameters.buildConfig }} ${{ parameters.archType }} cross /p:RuntimeVariant=${{ parameters.runtimeVariant }} -maxcpucount:1 displayName: "AOT cross-compile CoreCLR tests" # Checks the value of the compileOnHelix parameter diff --git a/src/tests/Interop/Interop.csproj b/src/tests/Interop/Interop.csproj index 2a02c40a4fd511..d071a5b6e1037c 100644 --- a/src/tests/Interop/Interop.csproj +++ b/src/tests/Interop/Interop.csproj @@ -1,11 +1,9 @@ - true + true true Debug;Release;Checked - - true diff --git a/src/tests/build.proj b/src/tests/build.proj index 699fcdfdb48ee3..8e587719fa3c96 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -126,8 +126,6 @@ - - From 6068e5c54a369932e2efb7a0617c6b44cbff2ba3 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 8 Apr 2024 15:55:13 +0200 Subject: [PATCH 07/31] Disable mini fullAOT failing tests --- src/tests/issues.targets | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 5adad1d0a7793c..7145fe232ae99e 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -2582,7 +2582,37 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 05da18f55ad7fd44d8c72895f22a8e3275648843 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 9 Apr 2024 09:37:55 +0200 Subject: [PATCH 08/31] Disable failing fullAOT mini tests on arm64 --- src/tests/issues.targets | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 7145fe232ae99e..6ba55e618f6dd1 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -2584,7 +2584,9 @@ + + @@ -2613,6 +2615,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + From b8d3a0965a31e01c98e9896157fd3db0091dce72 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 9 Apr 2024 09:47:10 +0200 Subject: [PATCH 09/31] Resolve AOT compilation failures --- src/tests/JIT/Methodical/Invoke/25params/25paramMixed_d.ilproj | 2 +- src/tests/JIT/Methodical/Invoke/25params/25paramMixed_r.ilproj | 2 +- src/tests/JIT/Methodical/VT/callconv/jumper4_r.ilproj | 2 +- src/tests/JIT/Methodical/VT/callconv/jumper5_r.ilproj | 2 +- src/tests/JIT/Methodical/tailcall/deep_value_d.ilproj | 2 +- src/tests/JIT/Methodical/tailcall/deep_value_r.ilproj | 2 +- .../JIT/Regression/JitBlue/Runtime_80731/Runtime_80731.ilproj | 2 +- .../JIT/Regression/JitBlue/Runtime_93876/Runtime_93876.csproj | 2 +- src/tests/JIT/jit64/localloc/call/call05_dynamic.ilproj | 2 +- src/tests/JIT/jit64/localloc/call/call05_large.ilproj | 2 +- src/tests/JIT/jit64/localloc/call/call05_small.ilproj | 2 +- src/tests/build.proj | 2 ++ 12 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_d.ilproj b/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_d.ilproj index fe8b1a480f4b6b..05172e91883222 100644 --- a/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_d.ilproj +++ b/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_d.ilproj @@ -2,7 +2,7 @@ Full - true + true diff --git a/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_r.ilproj b/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_r.ilproj index 7a897e1c58034f..ed41f933c95c7f 100644 --- a/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_r.ilproj +++ b/src/tests/JIT/Methodical/Invoke/25params/25paramMixed_r.ilproj @@ -3,7 +3,7 @@ PdbOnly False - true + true diff --git a/src/tests/JIT/Methodical/VT/callconv/jumper4_r.ilproj b/src/tests/JIT/Methodical/VT/callconv/jumper4_r.ilproj index 853a2846756e5d..60ccb79953cc46 100644 --- a/src/tests/JIT/Methodical/VT/callconv/jumper4_r.ilproj +++ b/src/tests/JIT/Methodical/VT/callconv/jumper4_r.ilproj @@ -2,7 +2,7 @@ PdbOnly - true + true diff --git a/src/tests/JIT/Methodical/VT/callconv/jumper5_r.ilproj b/src/tests/JIT/Methodical/VT/callconv/jumper5_r.ilproj index 34f063e8e6d63b..b8865c8b7a9764 100644 --- a/src/tests/JIT/Methodical/VT/callconv/jumper5_r.ilproj +++ b/src/tests/JIT/Methodical/VT/callconv/jumper5_r.ilproj @@ -2,7 +2,7 @@ PdbOnly - true + true diff --git a/src/tests/JIT/Methodical/tailcall/deep_value_d.ilproj b/src/tests/JIT/Methodical/tailcall/deep_value_d.ilproj index f5164fca8eb482..b6b980da973c87 100644 --- a/src/tests/JIT/Methodical/tailcall/deep_value_d.ilproj +++ b/src/tests/JIT/Methodical/tailcall/deep_value_d.ilproj @@ -2,7 +2,7 @@ Full - true + true diff --git a/src/tests/JIT/Methodical/tailcall/deep_value_r.ilproj b/src/tests/JIT/Methodical/tailcall/deep_value_r.ilproj index e87dfc81593d57..43ad99314adaab 100644 --- a/src/tests/JIT/Methodical/tailcall/deep_value_r.ilproj +++ b/src/tests/JIT/Methodical/tailcall/deep_value_r.ilproj @@ -2,7 +2,7 @@ PdbOnly - true + true diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_80731/Runtime_80731.ilproj b/src/tests/JIT/Regression/JitBlue/Runtime_80731/Runtime_80731.ilproj index 3b9e585f73d2f6..bcd5145cfe6b8c 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_80731/Runtime_80731.ilproj +++ b/src/tests/JIT/Regression/JitBlue/Runtime_80731/Runtime_80731.ilproj @@ -3,7 +3,7 @@ None True - true + true diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_93876/Runtime_93876.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_93876/Runtime_93876.csproj index 2bebd3c4781096..a0372f6a7fe35f 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_93876/Runtime_93876.csproj +++ b/src/tests/JIT/Regression/JitBlue/Runtime_93876/Runtime_93876.csproj @@ -2,7 +2,7 @@ True - true + true diff --git a/src/tests/JIT/jit64/localloc/call/call05_dynamic.ilproj b/src/tests/JIT/jit64/localloc/call/call05_dynamic.ilproj index 9f474264e2392d..d928fb596576a5 100644 --- a/src/tests/JIT/jit64/localloc/call/call05_dynamic.ilproj +++ b/src/tests/JIT/jit64/localloc/call/call05_dynamic.ilproj @@ -3,7 +3,7 @@ PdbOnly True - true + true diff --git a/src/tests/JIT/jit64/localloc/call/call05_large.ilproj b/src/tests/JIT/jit64/localloc/call/call05_large.ilproj index 036de917e452cb..36654f8d202f30 100644 --- a/src/tests/JIT/jit64/localloc/call/call05_large.ilproj +++ b/src/tests/JIT/jit64/localloc/call/call05_large.ilproj @@ -3,7 +3,7 @@ PdbOnly True - true + true diff --git a/src/tests/JIT/jit64/localloc/call/call05_small.ilproj b/src/tests/JIT/jit64/localloc/call/call05_small.ilproj index 123c33f4e834aa..710e2faf5ab50e 100644 --- a/src/tests/JIT/jit64/localloc/call/call05_small.ilproj +++ b/src/tests/JIT/jit64/localloc/call/call05_small.ilproj @@ -3,7 +3,7 @@ PdbOnly True - true + true diff --git a/src/tests/build.proj b/src/tests/build.proj index 8e587719fa3c96..3030296560bab4 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -126,6 +126,8 @@ + + From f84feb5c16ea595a8336aa2444171942260d634e Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 9 Apr 2024 12:15:00 +0200 Subject: [PATCH 10/31] Disable failing fullAOT mini tests on arm64 --- src/tests/issues.targets | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 6ba55e618f6dd1..b12e7b232f553a 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -2587,6 +2587,8 @@ + + @@ -2616,10 +2618,13 @@ - - + + + + + @@ -2640,6 +2645,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + From 985438134b166b852635131c1896c31c62730a8b Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Tue, 9 Apr 2024 15:01:15 +0200 Subject: [PATCH 11/31] Test GCC directive in arm64_emit_load_got_slot --- src/mono/mono/mini/aot-compiler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index bda04415e2d682..a9aa0b596c39d6 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -1348,7 +1348,7 @@ arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot) emit_unset_mode (acfg); /* r16==ip0 */ offset = (int)(got_slot * TARGET_SIZEOF_VOID_P); -#ifdef TARGET_MACH +#ifdef GCC /* clang's integrated assembler */ fprintf (acfg->fp, "adrp x16, %s@PAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); #ifdef MONO_ARCH_ILP32 From ecd921cbf043d87c4f3a1bcea3f4a0c77c8bbf96 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 11 Apr 2024 16:20:21 +0200 Subject: [PATCH 12/31] Introduce AsmType enum --- src/mono/mono/mini/aot-compiler.c | 45 +++++++++++++++++++------------ 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index a9aa0b596c39d6..47d0ec101dfc5e 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -183,6 +183,11 @@ struct _ReadOnlyValue { }; static ReadOnlyValue *readonly_values; +typedef enum { + GNU_AS, + CLANG_AS +} AsmType; + typedef struct MonoAotOptions { char *outfile; char *llvm_outfile; @@ -221,7 +226,7 @@ typedef struct MonoAotOptions { // The name of the assembly for which the AOT module is going to have all deduped methods moved to. // When set, we are emitting inflated methods only char *dedup_include; - gboolean gnu_asm; + AsmType asm_type; gboolean try_llvm; gboolean llvm; gboolean llvm_only; @@ -1292,7 +1297,7 @@ arch_init (MonoAotCompile *acfg) acfg->llvm_label_prefix = "_"; acfg->inst_directive = ".word"; acfg->need_no_dead_strip = TRUE; - acfg->aot_opts.gnu_asm = TRUE; + acfg->aot_opts.asm_type = CLANG_AS; #endif #if defined(__linux__) && !defined(TARGET_ARM) @@ -1348,22 +1353,24 @@ arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot) emit_unset_mode (acfg); /* r16==ip0 */ offset = (int)(got_slot * TARGET_SIZEOF_VOID_P); -#ifdef GCC - /* clang's integrated assembler */ - fprintf (acfg->fp, "adrp x16, %s@PAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); + if (acfg->aot_opts.asm_type == CLANG_AS) { + /* clang's integrated assembler */ + fprintf (acfg->fp, "adrp x16, %s@PAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); #ifdef MONO_ARCH_ILP32 - fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff); - fprintf (acfg->fp, "ldr w%d, [x16, #%d]\n", dreg, 0); + fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff); + fprintf (acfg->fp, "ldr w%d, [x16, #%d]\n", dreg, 0); #else - fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF\n", acfg->got_symbol); - fprintf (acfg->fp, "ldr x%d, [x16, #%d]\n", dreg, offset & 0xfff); -#endif -#else - /* Linux GAS */ - fprintf (acfg->fp, "adrp x16, %s+%d\n", acfg->got_symbol, offset & 0xfffff000); - fprintf (acfg->fp, "add x16, x16, :lo12:%s\n", acfg->got_symbol); - fprintf (acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); -#endif + fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF\n", acfg->got_symbol); + fprintf (acfg->fp, "ldr x%d, [x16, #%d]\n", dreg, offset & 0xfff); +#endif + } else if (acfg->aot_opts.asm_type == GNU_AS) { + /* Linux GAS */ + fprintf (acfg->fp, "adrp x16, %s+%d\n", acfg->got_symbol, offset & 0xfffff000); + fprintf (acfg->fp, "add x16, x16, :lo12:%s\n", acfg->got_symbol); + fprintf (acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); + } else { + g_assert_not_reached (); + } } static void @@ -8945,6 +8952,10 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts) opts->as_prefix = g_strdup (arg + strlen ("as-prefix=")); } else if (str_begins_with (arg, "as-name=")) { opts->as_name = g_strdup (arg + strlen ("as-name=")); + if (opts->as_name && !strcmp (opts->as_name, "clang")) + opts->asm_type = CLANG_AS; + else + opts->asm_type = GNU_AS; } else if (str_begins_with (arg, "as-options=")) { opts->as_options = g_strdup (arg + strlen ("as-options=")); } else if (str_begins_with (arg, "ld-flags=")) { @@ -15505,7 +15516,7 @@ emit_aot_image (MonoAotCompile *acfg) } } - if (acfg->aot_opts.dwarf_debug && acfg->aot_opts.gnu_asm) { + if (acfg->aot_opts.dwarf_debug && acfg->aot_opts.asm_type == CLANG_AS) { /* * CLANG supports GAS .file/.loc directives, so emit line number information this way */ From aae414a58de1dee15e6f5cbe2545e3f49e6b1dbe Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 11 Apr 2024 18:09:19 +0200 Subject: [PATCH 13/31] Test arm64_emit_load_got_slot with clang --- src/mono/mono/mini/aot-compiler.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 47d0ec101dfc5e..126e50c5835c81 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -1355,13 +1355,13 @@ arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot) offset = (int)(got_slot * TARGET_SIZEOF_VOID_P); if (acfg->aot_opts.asm_type == CLANG_AS) { /* clang's integrated assembler */ - fprintf (acfg->fp, "adrp x16, %s@PAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); + fprintf (acfg->fp, "adrp x16, %s@GOTPAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); #ifdef MONO_ARCH_ILP32 - fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff); - fprintf (acfg->fp, "ldr w%d, [x16, #%d]\n", dreg, 0); + fprintf (acfg->fp, "add x16, x16, %s@GOTPAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff); + fprintf (acfg->fp, "ldr w%d, [x16, %d]\n", dreg, 0); #else - fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF\n", acfg->got_symbol); - fprintf (acfg->fp, "ldr x%d, [x16, #%d]\n", dreg, offset & 0xfff); + fprintf (acfg->fp, "add x16, x16, %s@GOTPAGEOFF\n", acfg->got_symbol); + fprintf (acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); #endif } else if (acfg->aot_opts.asm_type == GNU_AS) { /* Linux GAS */ From 5f6af99aa3bd33025500471881f1f9c44f7bc41c Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 12 Apr 2024 11:15:07 +0200 Subject: [PATCH 14/31] Test arm64_emit_load_got_slot with clang --- src/mono/mono/mini/aot-compiler.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 126e50c5835c81..b27f0c4c4d8aab 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -1355,14 +1355,9 @@ arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot) offset = (int)(got_slot * TARGET_SIZEOF_VOID_P); if (acfg->aot_opts.asm_type == CLANG_AS) { /* clang's integrated assembler */ - fprintf (acfg->fp, "adrp x16, %s@GOTPAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); -#ifdef MONO_ARCH_ILP32 - fprintf (acfg->fp, "add x16, x16, %s@GOTPAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff); - fprintf (acfg->fp, "ldr w%d, [x16, %d]\n", dreg, 0); -#else - fprintf (acfg->fp, "add x16, x16, %s@GOTPAGEOFF\n", acfg->got_symbol); - fprintf (acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); -#endif + fprintf(acfg->fp, "adrp x16, %s@GOTPAGE\n", acfg->got_symbol); + fprintf(acfg->fp, "add x16, x16, %s@GOTPAGEOFF+%d\n", acfg->got_symbol, offset & 0xfffff000); + fprintf(acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); } else if (acfg->aot_opts.asm_type == GNU_AS) { /* Linux GAS */ fprintf (acfg->fp, "adrp x16, %s+%d\n", acfg->got_symbol, offset & 0xfffff000); From 77acadf036f96a568de79904adb9f796e2c7c5e8 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 12 Apr 2024 12:16:25 +0200 Subject: [PATCH 15/31] Revert changes --- src/mono/mono/mini/aot-compiler.c | 44 +++++++--------- src/tests/issues.targets | 85 ------------------------------- 2 files changed, 19 insertions(+), 110 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index b27f0c4c4d8aab..bda04415e2d682 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -183,11 +183,6 @@ struct _ReadOnlyValue { }; static ReadOnlyValue *readonly_values; -typedef enum { - GNU_AS, - CLANG_AS -} AsmType; - typedef struct MonoAotOptions { char *outfile; char *llvm_outfile; @@ -226,7 +221,7 @@ typedef struct MonoAotOptions { // The name of the assembly for which the AOT module is going to have all deduped methods moved to. // When set, we are emitting inflated methods only char *dedup_include; - AsmType asm_type; + gboolean gnu_asm; gboolean try_llvm; gboolean llvm; gboolean llvm_only; @@ -1297,7 +1292,7 @@ arch_init (MonoAotCompile *acfg) acfg->llvm_label_prefix = "_"; acfg->inst_directive = ".word"; acfg->need_no_dead_strip = TRUE; - acfg->aot_opts.asm_type = CLANG_AS; + acfg->aot_opts.gnu_asm = TRUE; #endif #if defined(__linux__) && !defined(TARGET_ARM) @@ -1353,19 +1348,22 @@ arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot) emit_unset_mode (acfg); /* r16==ip0 */ offset = (int)(got_slot * TARGET_SIZEOF_VOID_P); - if (acfg->aot_opts.asm_type == CLANG_AS) { - /* clang's integrated assembler */ - fprintf(acfg->fp, "adrp x16, %s@GOTPAGE\n", acfg->got_symbol); - fprintf(acfg->fp, "add x16, x16, %s@GOTPAGEOFF+%d\n", acfg->got_symbol, offset & 0xfffff000); - fprintf(acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); - } else if (acfg->aot_opts.asm_type == GNU_AS) { - /* Linux GAS */ - fprintf (acfg->fp, "adrp x16, %s+%d\n", acfg->got_symbol, offset & 0xfffff000); - fprintf (acfg->fp, "add x16, x16, :lo12:%s\n", acfg->got_symbol); - fprintf (acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); - } else { - g_assert_not_reached (); - } +#ifdef TARGET_MACH + /* clang's integrated assembler */ + fprintf (acfg->fp, "adrp x16, %s@PAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); +#ifdef MONO_ARCH_ILP32 + fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff); + fprintf (acfg->fp, "ldr w%d, [x16, #%d]\n", dreg, 0); +#else + fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF\n", acfg->got_symbol); + fprintf (acfg->fp, "ldr x%d, [x16, #%d]\n", dreg, offset & 0xfff); +#endif +#else + /* Linux GAS */ + fprintf (acfg->fp, "adrp x16, %s+%d\n", acfg->got_symbol, offset & 0xfffff000); + fprintf (acfg->fp, "add x16, x16, :lo12:%s\n", acfg->got_symbol); + fprintf (acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); +#endif } static void @@ -8947,10 +8945,6 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts) opts->as_prefix = g_strdup (arg + strlen ("as-prefix=")); } else if (str_begins_with (arg, "as-name=")) { opts->as_name = g_strdup (arg + strlen ("as-name=")); - if (opts->as_name && !strcmp (opts->as_name, "clang")) - opts->asm_type = CLANG_AS; - else - opts->asm_type = GNU_AS; } else if (str_begins_with (arg, "as-options=")) { opts->as_options = g_strdup (arg + strlen ("as-options=")); } else if (str_begins_with (arg, "ld-flags=")) { @@ -15511,7 +15505,7 @@ emit_aot_image (MonoAotCompile *acfg) } } - if (acfg->aot_opts.dwarf_debug && acfg->aot_opts.asm_type == CLANG_AS) { + if (acfg->aot_opts.dwarf_debug && acfg->aot_opts.gnu_asm) { /* * CLANG supports GAS .file/.loc directives, so emit line number information this way */ diff --git a/src/tests/issues.targets b/src/tests/issues.targets index b12e7b232f553a..928b3f49db4cc2 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -2584,91 +2584,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From fe61b45537856f7fec315a608fd166e564f0b263 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 12 Apr 2024 17:35:05 +0200 Subject: [PATCH 16/31] Fix g_assert in mono_arch_patch_plt_entry --- src/mono/mono/mini/tramp-arm64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/mini/tramp-arm64.c b/src/mono/mono/mini/tramp-arm64.c index 7e8483409610cd..9caf16aac31de9 100644 --- a/src/mono/mono/mini/tramp-arm64.c +++ b/src/mono/mono/mini/tramp-arm64.c @@ -52,7 +52,7 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin /* adrp */ ins = ((guint32*)code) [0]; - g_assert (((ins >> 24) & 0x1f) == 0x10); + g_assert (((ins >> 28) & 0x9) == 0x9); disp = (((ins >> 5) & 0x7ffff) << 2) | ((ins >> 29) & 0x3); /* FIXME: disp is signed */ g_assert ((disp >> 20) == 0); From c0f300300398bc6e8c8f02ebf94770f491c8160e Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 17 Apr 2024 13:35:44 +0200 Subject: [PATCH 17/31] Print ins in mono_arch_patch_plt_entry --- src/mono/mono/mini/tramp-arm64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/mini/tramp-arm64.c b/src/mono/mono/mini/tramp-arm64.c index 9caf16aac31de9..092061327bf4ae 100644 --- a/src/mono/mono/mini/tramp-arm64.c +++ b/src/mono/mono/mini/tramp-arm64.c @@ -52,7 +52,8 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin /* adrp */ ins = ((guint32*)code) [0]; - g_assert (((ins >> 28) & 0x9) == 0x9); + printf ("ins: %08x\n", ins); + g_assert (((ins >> 24) & 0x1f) == 0x10); disp = (((ins >> 5) & 0x7ffff) << 2) | ((ins >> 29) & 0x3); /* FIXME: disp is signed */ g_assert ((disp >> 20) == 0); From 3206717944abf9e7918dafc355fb53109231ea7f Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 22 Apr 2024 11:24:27 +0200 Subject: [PATCH 18/31] Use PAGE and PAGEOFF for arm64 reloc --- src/mono/mono/mini/aot-compiler.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index bda04415e2d682..aae14e86ab3fb6 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -1348,7 +1348,7 @@ arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot) emit_unset_mode (acfg); /* r16==ip0 */ offset = (int)(got_slot * TARGET_SIZEOF_VOID_P); -#ifdef TARGET_MACH +// #ifdef TARGET_MACH /* clang's integrated assembler */ fprintf (acfg->fp, "adrp x16, %s@PAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); #ifdef MONO_ARCH_ILP32 @@ -1357,13 +1357,13 @@ arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot) #else fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF\n", acfg->got_symbol); fprintf (acfg->fp, "ldr x%d, [x16, #%d]\n", dreg, offset & 0xfff); -#endif -#else +// #endif +// #else /* Linux GAS */ - fprintf (acfg->fp, "adrp x16, %s+%d\n", acfg->got_symbol, offset & 0xfffff000); - fprintf (acfg->fp, "add x16, x16, :lo12:%s\n", acfg->got_symbol); - fprintf (acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); -#endif + // fprintf (acfg->fp, "adrp x16, %s+%d\n", acfg->got_symbol, offset & 0xfffff000); + // fprintf (acfg->fp, "add x16, x16, :lo12:%s\n", acfg->got_symbol); + // fprintf (acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); +// #endif } static void From 6cf2229fa74bcff11fa02bf89e140bb0558b24ee Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 22 Apr 2024 11:36:00 +0200 Subject: [PATCH 19/31] Use PAGE and PAGEOFF for arm64 reloc --- src/mono/mono/mini/aot-compiler.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index aae14e86ab3fb6..08ba99fba447f5 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -1351,10 +1351,10 @@ arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot) // #ifdef TARGET_MACH /* clang's integrated assembler */ fprintf (acfg->fp, "adrp x16, %s@PAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); -#ifdef MONO_ARCH_ILP32 - fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff); - fprintf (acfg->fp, "ldr w%d, [x16, #%d]\n", dreg, 0); -#else +// #ifdef MONO_ARCH_ILP32 +// fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff); +// fprintf (acfg->fp, "ldr w%d, [x16, #%d]\n", dreg, 0); +// #else fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF\n", acfg->got_symbol); fprintf (acfg->fp, "ldr x%d, [x16, #%d]\n", dreg, offset & 0xfff); // #endif From 70b3118151bfad25cd18f319835094f9a2de97f4 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Mon, 22 Apr 2024 16:15:37 +0200 Subject: [PATCH 20/31] Use GOTPAGE and GOTPAGEOFF for arm64 reloc --- src/mono/mono/mini/aot-compiler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 08ba99fba447f5..1b94dcfd5987ab 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -1350,12 +1350,12 @@ arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot) offset = (int)(got_slot * TARGET_SIZEOF_VOID_P); // #ifdef TARGET_MACH /* clang's integrated assembler */ - fprintf (acfg->fp, "adrp x16, %s@PAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); + fprintf (acfg->fp, "adrp x16, %s@GOTPAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); // #ifdef MONO_ARCH_ILP32 // fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff); // fprintf (acfg->fp, "ldr w%d, [x16, #%d]\n", dreg, 0); // #else - fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF\n", acfg->got_symbol); + fprintf (acfg->fp, "add x16, x16, %s@GOTPAGEOFF\n", acfg->got_symbol); fprintf (acfg->fp, "ldr x%d, [x16, #%d]\n", dreg, offset & 0xfff); // #endif // #else From 2fa6762185e9237768a0e92df76bc36bc6114d02 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 24 Apr 2024 16:12:20 +0200 Subject: [PATCH 21/31] Add support for relocations within the same page on arm64 using clang toolchain --- src/mono/mono/mini/aot-compiler.c | 26 ++++++++++++------------ src/mono/mono/mini/tramp-arm64.c | 33 ++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/mono/mono/mini/aot-compiler.c b/src/mono/mono/mini/aot-compiler.c index 1b94dcfd5987ab..bda04415e2d682 100644 --- a/src/mono/mono/mini/aot-compiler.c +++ b/src/mono/mono/mini/aot-compiler.c @@ -1348,22 +1348,22 @@ arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot) emit_unset_mode (acfg); /* r16==ip0 */ offset = (int)(got_slot * TARGET_SIZEOF_VOID_P); -// #ifdef TARGET_MACH +#ifdef TARGET_MACH /* clang's integrated assembler */ - fprintf (acfg->fp, "adrp x16, %s@GOTPAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); -// #ifdef MONO_ARCH_ILP32 -// fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff); -// fprintf (acfg->fp, "ldr w%d, [x16, #%d]\n", dreg, 0); -// #else - fprintf (acfg->fp, "add x16, x16, %s@GOTPAGEOFF\n", acfg->got_symbol); + fprintf (acfg->fp, "adrp x16, %s@PAGE+%d\n", acfg->got_symbol, offset & 0xfffff000); +#ifdef MONO_ARCH_ILP32 + fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff); + fprintf (acfg->fp, "ldr w%d, [x16, #%d]\n", dreg, 0); +#else + fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF\n", acfg->got_symbol); fprintf (acfg->fp, "ldr x%d, [x16, #%d]\n", dreg, offset & 0xfff); -// #endif -// #else +#endif +#else /* Linux GAS */ - // fprintf (acfg->fp, "adrp x16, %s+%d\n", acfg->got_symbol, offset & 0xfffff000); - // fprintf (acfg->fp, "add x16, x16, :lo12:%s\n", acfg->got_symbol); - // fprintf (acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); -// #endif + fprintf (acfg->fp, "adrp x16, %s+%d\n", acfg->got_symbol, offset & 0xfffff000); + fprintf (acfg->fp, "add x16, x16, :lo12:%s\n", acfg->got_symbol); + fprintf (acfg->fp, "ldr x%d, [x16, %d]\n", dreg, offset & 0xfff); +#endif } static void diff --git a/src/mono/mono/mini/tramp-arm64.c b/src/mono/mono/mini/tramp-arm64.c index 092061327bf4ae..3241beeacb486c 100644 --- a/src/mono/mono/mini/tramp-arm64.c +++ b/src/mono/mono/mini/tramp-arm64.c @@ -53,17 +53,28 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin /* adrp */ ins = ((guint32*)code) [0]; printf ("ins: %08x\n", ins); - g_assert (((ins >> 24) & 0x1f) == 0x10); - disp = (((ins >> 5) & 0x7ffff) << 2) | ((ins >> 29) & 0x3); - /* FIXME: disp is signed */ - g_assert ((disp >> 20) == 0); - - slot_addr = ((guint64)code + (disp << 12)) & ~0xfff; - - /* add x16, x16, :lo12:got */ - ins = ((guint32*)code) [1]; - g_assert (((ins >> 22) & 0x3) == 0); - slot_addr += (ins >> 10) & 0xfff; + if (((ins >> 24) & 0x1f) == 0x10) { + // adrp x16, address + // add x16, x16, offset + disp = (((ins >> 5) & 0x7ffff) << 2) | ((ins >> 29) & 0x3); + /* FIXME: disp is signed */ + g_assert ((disp >> 20) == 0); + + slot_addr = ((guint64)code + (disp << 12)) & ~0xfff; + + /* add x16, x16, :lo12:got */ + ins = ((guint32*)code) [1]; + g_assert (((ins >> 22) & 0x3) == 0); + slot_addr += (ins >> 10) & 0xfff; + printf ("slot_addr (adrp): %llx\n", slot_addr); + } else if (((ins >> 24) & 0x1f) == 0x15) { + // nop + // adr x16, address + slot_addr = (guint64)code; + printf ("slot_addr (adr): %llx\n", slot_addr); + } else { + g_assert_not_reached (); + } /* ldr x16, [x16, ] */ ins = ((guint32*)code) [2]; From 748f74762b27a42bdfb3253bc8ee28f85335b580 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 25 Apr 2024 10:02:35 +0200 Subject: [PATCH 22/31] Add displacement to the base address for adr ins in plt relocation --- src/mono/mono/mini/tramp-arm64.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/mini/tramp-arm64.c b/src/mono/mono/mini/tramp-arm64.c index 3241beeacb486c..91c5a0a0c6de78 100644 --- a/src/mono/mono/mini/tramp-arm64.c +++ b/src/mono/mono/mini/tramp-arm64.c @@ -70,7 +70,10 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin } else if (((ins >> 24) & 0x1f) == 0x15) { // nop // adr x16, address - slot_addr = (guint64)code; + disp = (((ins >> 5) & 0x7ffff) << 2); + /* FIXME: disp is signed */ + g_assert ((disp >> 20) == 0); + slot_addr = (guint64)(code + disp); printf ("slot_addr (adr): %llx\n", slot_addr); } else { g_assert_not_reached (); From 2c459721d2d257291eefbffb8cf704175c131321 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 25 Apr 2024 12:08:15 +0200 Subject: [PATCH 23/31] Fix displacement for adr ins in mono_arch_patch_plt_entry --- src/mono/mono/mini/tramp-arm64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mono/mono/mini/tramp-arm64.c b/src/mono/mono/mini/tramp-arm64.c index 91c5a0a0c6de78..8747d53fe5e2a6 100644 --- a/src/mono/mono/mini/tramp-arm64.c +++ b/src/mono/mono/mini/tramp-arm64.c @@ -70,6 +70,7 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin } else if (((ins >> 24) & 0x1f) == 0x15) { // nop // adr x16, address + ins = ((guint32*)code) [1]; disp = (((ins >> 5) & 0x7ffff) << 2); /* FIXME: disp is signed */ g_assert ((disp >> 20) == 0); From 896a9fe88a4ae191fec06483866db104fd78b2b6 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 30 May 2024 18:05:18 +0200 Subject: [PATCH 24/31] Add ROOTFS_HOST_DIR environment variable --- eng/pipelines/common/templates/pipeline-with-resources.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/common/templates/pipeline-with-resources.yml b/eng/pipelines/common/templates/pipeline-with-resources.yml index 01d326c6040544..d4cb11c97beb0d 100644 --- a/eng/pipelines/common/templates/pipeline-with-resources.yml +++ b/eng/pipelines/common/templates/pipeline-with-resources.yml @@ -30,6 +30,7 @@ extends: image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-arm64-net9.0 env: ROOTFS_DIR: /crossrootfs/arm64 + ROOTFS_HOST_DIR: / linux_musl_x64: image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-amd64-alpine-net9.0 From 6e2e74ab0be8152d8477b7199083899493d187a9 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Thu, 30 May 2024 18:52:31 +0200 Subject: [PATCH 25/31] Update llvm path to work with the new docker image --- .../runtimes/build-runtime-tests-and-send-to-helix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml index e13a575af85460..cfca067a71adad 100644 --- a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml +++ b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml @@ -47,7 +47,7 @@ steps: -arch ${{ parameters.archType }} /p:BuildMonoAotCrossCompiler=true /p:BuildMonoAotCrossCompilerOnly=true - /p:MonoLibClang="/usr/local/lib/libclang.so.16" + /p:MonoLibClang="/usr/local/lib/libclang.so" /p:CrossBuild=true displayName: "Build Mono Mini AOT cross compiler" - ${{ else }}: @@ -57,7 +57,7 @@ steps: -arch ${{ parameters.archType }} /p:BuildMonoAotCrossCompiler=true /p:BuildMonoAotCrossCompilerOnly=true - /p:MonoLibClang="/usr/local/lib/libclang.so.16" + /p:MonoLibClang="/usr/local/lib/libclang.so" /p:MonoAOTEnableLLVM=true /p:CrossBuild=true displayName: "Build Mono LLVM AOT cross compiler" From 9ad4df93426c3d7269220600b7fafa035f39dfaa Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 31 May 2024 09:55:15 +0200 Subject: [PATCH 26/31] Update MonoCrossDir condition to point to the host rootfs --- src/mono/mono.proj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 8f02901b6d7715..b39d233ea891df 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -259,7 +259,7 @@ JS_ENGINES = [NODE_JS] - + @@ -281,7 +281,7 @@ JS_ENGINES = [NODE_JS] - false - + @@ -932,7 +932,7 @@ JS_ENGINES = [NODE_JS] The runtime is built using the 'ROOTFS_DIR' which points to '/crossrootfs/arm64'. The 'mono-aot-cross' is built using the 'ROOTFS_HOST_DIR' which points to '/crossrootfs/x64'. --> - + $(ROOTFS_HOST_DIR) From 629a203f35506f68ae1ba8f0e6a47b7e163f71a5 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 31 May 2024 12:23:25 +0200 Subject: [PATCH 27/31] Fix reloc condition for nop ins --- src/mono/mono/mini/tramp-arm64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/mini/tramp-arm64.c b/src/mono/mono/mini/tramp-arm64.c index 6914403de2a546..f28bb34a94fe5c 100644 --- a/src/mono/mono/mini/tramp-arm64.c +++ b/src/mono/mono/mini/tramp-arm64.c @@ -67,7 +67,7 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin g_assert (((ins >> 22) & 0x3) == 0); slot_addr += (ins >> 10) & 0xfff; printf ("slot_addr (adrp): %llx\n", slot_addr); - } else if (((ins >> 24) & 0x1f) == 0x15) { + } else if (((ins >> 24) & 0x1f) == 0x1f) { // nop // adr x16, address ins = ((guint32*)code) [1]; From f917792d39002aef5f6bbf309e954843e3bf46dd Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 31 May 2024 15:38:19 +0200 Subject: [PATCH 28/31] Fix reloc condition for nop ins --- src/mono/mono/mini/tramp-arm64.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/mini/tramp-arm64.c b/src/mono/mono/mini/tramp-arm64.c index f28bb34a94fe5c..13d1dc291a4621 100644 --- a/src/mono/mono/mini/tramp-arm64.c +++ b/src/mono/mono/mini/tramp-arm64.c @@ -54,27 +54,38 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin ins = ((guint32*)code) [0]; printf ("ins: %08x\n", ins); if (((ins >> 24) & 0x1f) == 0x10) { + printf("ADRP instruction detected\n"); // adrp x16, address // add x16, x16, offset disp = (((ins >> 5) & 0x7ffff) << 2) | ((ins >> 29) & 0x3); + printf("disp: %08x\n", disp); /* FIXME: disp is signed */ g_assert ((disp >> 20) == 0); slot_addr = ((guint64)code + (disp << 12)) & ~0xfff; + printf("slot_addr: %llx\n", slot_addr); /* add x16, x16, :lo12:got */ ins = ((guint32*)code) [1]; + printf ("ins[1]: %08x\n", ins); g_assert (((ins >> 22) & 0x3) == 0); slot_addr += (ins >> 10) & 0xfff; printf ("slot_addr (adrp): %llx\n", slot_addr); - } else if (((ins >> 24) & 0x1f) == 0x1f) { + } else if (((ins >> 24) & 0x1f) == 0x15) { + printf("ADR instruction detected\n"); // nop // adr x16, address ins = ((guint32*)code) [1]; + printf ("ins[1]: %08x\n", ins); disp = (((ins >> 5) & 0x7ffff) << 2); + printf("disp: %08x\n", disp); + if (disp & (1 << 20)) { + disp |= ~((1 << 21) - 1); + } + printf("disp fix: %08x\n", disp); /* FIXME: disp is signed */ g_assert ((disp >> 20) == 0); - slot_addr = (guint64)(code + disp); + slot_addr = (guint64)((char*)code + disp); printf ("slot_addr (adr): %llx\n", slot_addr); } else { g_assert_not_reached (); @@ -82,8 +93,10 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin /* ldr x16, [x16, ] */ ins = ((guint32*)code) [2]; + printf ("ins[2]: %08x\n", ins); g_assert (((ins >> 24) & 0x3f) == 0x39); slot_addr += ((ins >> 10) & 0xfff) * 8; + printf ("slot_addr (ldr): %llx\n", slot_addr); g_assert (*(guint64*)slot_addr); *(gpointer*)slot_addr = addr; From 0b053476f9778d699f641df59135470a8d1c73d9 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 5 Jun 2024 12:29:13 +0200 Subject: [PATCH 29/31] Add debug print to mono_arch_patch_plt_entry --- src/mono/mono/mini/tramp-arm64.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mono/mono/mini/tramp-arm64.c b/src/mono/mono/mini/tramp-arm64.c index 13d1dc291a4621..22097e248150fe 100644 --- a/src/mono/mono/mini/tramp-arm64.c +++ b/src/mono/mono/mini/tramp-arm64.c @@ -50,6 +50,13 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin * aot-compiler.c */ + // print next 4 instructions + printf ("mono_arch_patch_plt_entry begin\n"); + printf ("ins0: %08x\n", ((guint32*)code) [0]); + printf ("ins1: %08x\n", ((guint32*)code) [1]); + printf ("ins2: %08x\n", ((guint32*)code) [2]); + prinf ("\n"); + /* adrp */ ins = ((guint32*)code) [0]; printf ("ins: %08x\n", ins); @@ -100,6 +107,8 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin g_assert (*(guint64*)slot_addr); *(gpointer*)slot_addr = addr; + + printf ("mono_arch_patch_plt_entry end\n"); } void From 516c39ed4e10085d080a85c924a8cd7fc74eb81d Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 5 Jun 2024 12:41:39 +0200 Subject: [PATCH 30/31] Fix typo --- src/mono/mono/mini/tramp-arm64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/mini/tramp-arm64.c b/src/mono/mono/mini/tramp-arm64.c index 22097e248150fe..e595b9ab18bfd0 100644 --- a/src/mono/mono/mini/tramp-arm64.c +++ b/src/mono/mono/mini/tramp-arm64.c @@ -55,7 +55,7 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin printf ("ins0: %08x\n", ((guint32*)code) [0]); printf ("ins1: %08x\n", ((guint32*)code) [1]); printf ("ins2: %08x\n", ((guint32*)code) [2]); - prinf ("\n"); + printf ("\n"); /* adrp */ ins = ((guint32*)code) [0]; From 06d239197fe60ea6296fef8dda8ee989da1900ef Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Wed, 5 Jun 2024 18:32:46 +0200 Subject: [PATCH 31/31] Add debug print --- src/mono/mono/mini/tramp-arm64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/mini/tramp-arm64.c b/src/mono/mono/mini/tramp-arm64.c index e595b9ab18bfd0..5dd1f7927cbeaf 100644 --- a/src/mono/mono/mini/tramp-arm64.c +++ b/src/mono/mono/mini/tramp-arm64.c @@ -51,11 +51,12 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, host_mgreg_t *regs, guin */ // print next 4 instructions + printf ("\n"); printf ("mono_arch_patch_plt_entry begin\n"); + printf ("code addr: %p\n", code); printf ("ins0: %08x\n", ((guint32*)code) [0]); printf ("ins1: %08x\n", ((guint32*)code) [1]); printf ("ins2: %08x\n", ((guint32*)code) [2]); - printf ("\n"); /* adrp */ ins = ((guint32*)code) [0];