Skip to content

Commit

Permalink
ci: use GCC 13 as cross compiler in dist-aarch64-linux
Browse files Browse the repository at this point in the history
I'm proposing this GCC upgrade since it addresses bug rust-lang#125619. The regression
in question affects stable release consumers who tend to have no experience
dealing with Rust build tools, so if at all possible, I would like to have it
resolved in the next stable release. I have tried to fix the bug in
`compiler-builtins`, which led to submitting a PR for `compiler-rt` in upstream
LLVM, but it may take a long time before these upstreams address this
regression.

A summary of why upgrading GCC solves the regression follows. `__multc3()` is a
builtin function `compiler-builtins` exposes for specifically aarch64,
non-Windows targets [1]. The object file for it is included in `staticlib`
archives through `libstd`. The implementation for `__multc3()` is from
`multc3.c`, part of LLVM's `compiler-rt`. Upstream `compiler-rt` normally
builds the C file using the Clang from the same LLVM version. On the
other hand, `compiler-builtins` builds the C file using GCC, outside of the
usual LLVM build system. The upstream implementation doesn't have
feature detection which works for GCC version older than 10, and ends up
producing an unlinkable object.

Upstream LLVM might be slow to respond to this issue as they might deem
`compiler-builtin` as doing something out of the ordinary from their
perspective. They might reasonably assume everyone to build `compiler-rt` using
LLVM's build system.

I have done the following to test this change:
 - verified that a local build without this patch exhibits the regression.
 - verified that with this patch, the object for `__multc3()` has no reference
   to undefined functions in the symbol table.
 - verified that with this patch, `rustc` is usable to build Ruby with YJIT,
   and that the reported regression is resolved.

[1]: https://github.com/rust-lang/compiler-builtins/blob/c04eb9e1afb72bdf943f5e5d77b3812f40526602/build.rs#L524-L539
  • Loading branch information
XrXr committed Jun 4, 2024
1 parent 23e040a commit b8047d3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion src/ci/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ For targets: `aarch64-unknown-linux-gnu`
- Operating System > Linux kernel version = 4.1.49
- Binary utilities > Version of binutils = 2.29.1
- C-library > glibc version = 2.17 -- aarch64 support was introduced in this version
- C compiler > gcc version = 8.5.0
- C compiler > gcc version = 13.2.0
- C compiler > C++ = ENABLE -- to cross compile LLVM
### `i586-linux-gnu.defconfig`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ CT_ARCH_ARM=y
CT_ARCH_64=y
CT_KERNEL_LINUX=y
CT_LINUX_V_4_1=y
CT_BINUTILS_V_2_29=y
CT_GLIBC_V_2_17=y
CT_GCC_V_8=y
CT_CC_LANG_CXX=y

0 comments on commit b8047d3

Please sign in to comment.