Fix redhat arm64 (#52244)
authorJan Vorlicek <jan.vorlicek@volny.cz>
Wed, 28 Jul 2021 20:51:25 +0000 (22:51 +0200)
committerGitHub <noreply@github.com>
Wed, 28 Jul 2021 20:51:25 +0000 (22:51 +0200)
commit39803d4d3cbf818641437afb7402da15fa076bec
treeebe9aa0f5247561188afe3196c6eeb52c057524b
parentbeaea95307ab7b4702054aeadc0ec4cb268103ee
Fix redhat arm64 (#52244)

* Fix RHEL 8 ARM64

Clang on ARM64 places the .rodata section into the same segment
as .text. On RHEL 8 ARM64, the kernel is configured for 64kB
memory pages. When we flip the page protection of the page containing
the GS cookie to RW and back to RO, we assume that the cookie lives
in a non-executable memory. This assumption is broken on RHEL 8 and
we end up setting protection of a part of the coreclr code to read
only instead of back to RX.

This change switches the linker we use to lld from the previously
used gnu linker. That linker places .rodata into a different segment
than .text by default. Moreover, I was planning to move to using
lld anyways to use all build tools from LLVM.

* Fix ARM build to use PC relative addresses only

The lld linker has revealed that we were using absolute addresses in some
asm helpers and so load time relocation was necessary. This change fixes
it by replacing all of those by PC relative ones.

* Update docker images used for building runtime

Use new images that have lld linker

* Disable lld linker for s390x
eng/common/templates/jobs/source-build.yml
eng/native/configuretools.cmake
eng/native/functions.cmake
eng/native/init-compiler.sh
eng/pipelines/common/platform-matrix.yml
src/coreclr/pgosupport.cmake
src/coreclr/vm/CMakeLists.txt
src/coreclr/vm/arm/asmhelpers.S
src/coreclr/vm/arm/pinvokestubs.S
src/coreclr/vm/arm/stubs.cpp