-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Build on CBL-mariner host with rootfs #84148
Conversation
This change enables cross-building for Alpine x64 on other x64 distro.
Necessary because pkg-config on mariner is a shim for pkgconf, which doesn't support override variables.
- Use lld for LTO instead of ld.gold - Set cross toolchain options for x64 mono build - Prefer llvm-objcopy for mono symbol stripping
Our custom LLVM build seems to have different defaults when targeting ARM than the clang-12 available in ubuntu. Probably related to https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/commit/b7363248b115339c4fb838fcd3ae43671eedae0a. Passing the -march explicitly should not hurt.
Allow text relocations. The lld defaults differ from ld, which will add text relocations on demand by default. See https://maskray.me/blog/2020-12-19-lld-and-gnu-linker-incompatibilities
+ more cleanup
To locate gcc toolchain in target sysroot, when host arch matches target arch.
Tagging subscribers to this area: @hoyosjs Issue Detailsnull
|
Co-authored-by: Adeel Mujahid <[email protected]>
Since this is merged with the LinkerFlavor=lld change, despite the discussion in #84493, let me reiterate: lld in NativeAOT was supposed to be experimental / optional. Switching CI to lld wholesale, while default linker in NativeAOT build integration for user is still bfd, is a strange move. The size of bfd linker in binary form is 1.5 MB on linux-arm64, while I can see there are number of unused tools present in the CBL image as part of llvm-toolchian. We are not saving or simplifying anything by omitting the tiny bfd linker binary from the CBL image. bfd is the default linker on mainstream distros and an important component to skip from official .NET builder images. Also, this is less about "the size of published binary increases with lld compared to bfd" and more about "testing the product in CI with what the end-user on mainstream distros gets as default". lld is not installed as part of llvm package on Debian, Alpine etc. either, it is a a completely separate package for reasons. lld is a "compatibility linker" for bfd. See https://maskray.me/blog/2020-12-19-lld-and-gnu-linker-incompatibilities which explain that while they are trying to close the gaps in some areas with newer versions of lld, they intend to diverge from bfd in others areas. We should revert LinkerFlavor=lld changes made in this PR for CI or at least understand the implications before switching to something which was added as experimental a few weeks ago. BTW,
|
Fixes dotnet/runtime#84780. Tested by hooking up the changes locally with runtime's `jitformat.py` and running `python3 ./src/coreclr/scripts/jitformat.py -c /runtime/src/coreclr -o linux -a x64` in our mariner build container. This might break scenarios where jitutils are used outside of ci on a non-mariner build image. Per discussion with @BruceForstall let's make a quick fix to unblock ci, and if this is problematic we could for example add an extra argument that controls whether the `-cross` argument is passed to the runtime build. For context, the `-cross` argument is necessary after dotnet/runtime#84148 because our linux build images have change from centos 7 to CBL-mariner, and the linux builds are now cross-builds that use a rootfs (even x64 and x64-musl).
This PR (or a related one) breaks System.Net.Security.Enterprise.Test builds (https://dev.azure.com/dnceng-public/public/_build/results?buildId=243440&view=logs&j=03b95830-93c2-599b-7e4d-1efb940adc28&t=9abf97cd-b4a3-5a26-6cf2-d05ce865f2ef&l=3907).
The docker image used (mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04) has clang-9 but no lld binary installed. Will that be fixed by the TODO at |
To reflect the plan in dotnet/runtime#83428, and changes made in dotnet/runtime#84148.
This changes the linux builds to use the CBL-mariner build images added in dotnet/dotnet-buildtools-prereqs-docker#832. All of these builds are now cross-builds with a rootfs (including x64, and x64 musl).
--gc-sections
with lld (see Add LinkerFlavor to NativeAOT #83558 (comment)). cc @MichalStrehovskyAS_NAME
here:runtime/src/mono/mono/mini/aot-compiler.c
Line 13030 in 1d2cd20
Contributes to #83428.