Skip to content
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

ci: use GCC 13 as cross compiler in dist-aarch64-linux #125999

Merged
merged 1 commit into from
Jun 9, 2024

Conversation

XrXr
Copy link
Contributor

@XrXr XrXr commented Jun 4, 2024

I'm proposing this GCC upgrade since it addresses bug #125619. The
regression in question affects stable release consumers who tend to have
no exposure to 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 builds compiler-rt
through 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.

Since loongarch64-linux-gnu already uses GCC 13.2.0, I hope we can upgrade without issues.

try-job: dist-aarch64-linux

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 exposure to 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 builds `compiler-rt`
through 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
@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2024

r? @Kobzol

rustbot has assigned @Kobzol.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Jun 4, 2024
@Kobzol
Copy link
Contributor

Kobzol commented Jun 5, 2024

@cuviper You have last touched the crosstool-ng configuration :) Do you think it's fine in general to upgrade GCC from 8 to 13, is the old(er) version important for anything specific? I seem to recall some issues with updating GCC too much on the x64 Linux runner.

@cuviper
Copy link
Member

cuviper commented Jun 5, 2024

@Kobzol I'm not sure what issues you're recalling, but there is some risk of symbol versioning trouble with libgcc_s.so.1, which we haven't been very careful about like we have for glibc versions. I think they don't change as often as glibc though. Here's what I see in that library on Ubuntu 24.04 aarch64:

    40: 000000000000fc20   308 FUNC    GLOBAL DEFAULT   12 __extendhftf2@@GCC_11.0
    89: 0000000000011820   244 FUNC    GLOBAL DEFAULT   12 __fixunshfti@@GCC_11.0
    99: 0000000000004260  1008 FUNC    GLOBAL DEFAULT   12 __mulhc3@@GCC_11.0
   103: 0000000000011920   656 FUNC    GLOBAL DEFAULT   12 __floattihf@@GCC_11.0
   105: 00000000000105a0   920 FUNC    GLOBAL DEFAULT   12 __trunctfhf2@@GCC_11.0
   117: 00000000000052a0   652 FUNC    GLOBAL DEFAULT   12 __divhc3@@GCC_11.0
   204: 0000000000011bc0   424 FUNC    GLOBAL DEFAULT   12 __floatuntihf@@GCC_11.0
   205: 0000000000011720   248 FUNC    GLOBAL DEFAULT   12 __fixhfti@@GCC_11.0
    83: 0000000000011f60   344 FUNC    GLOBAL DEFAULT   12 __floatundibf@@GCC_13.0.0
    86: 0000000000010ce0   904 FUNC    GLOBAL DEFAULT   12 __truncdfbf2@@GCC_13.0.0
   112: 0000000000012360   516 FUNC    GLOBAL DEFAULT   12 __floatuntibf@@GCC_13.0.0
   118: 0000000000010940   920 FUNC    GLOBAL DEFAULT   12 __trunctfbf2@@GCC_13.0.0
   119: 00000000000113a0   876 FUNC    GLOBAL DEFAULT   12 __trunchfbf2@@GCC_13.0.0
   132: 0000000000011d80   460 FUNC    GLOBAL DEFAULT   12 __floatdibf@@GCC_13.0.0
   149: 0000000000011080   792 FUNC    GLOBAL DEFAULT   12 __truncsfbf2@@GCC_13.0.0
   152: 000000000000fd60   216 FUNC    GLOBAL DEFAULT   12 __extendbfsf2@@GCC_13.0.0
   182: 00000000000120c0   664 FUNC    GLOBAL DEFAULT   12 __floattibf@@GCC_13.0.0

... and there are more for @@GCC_14.0.0. But looking at both Fedora's and Ubuntu's Rust toolchains that did build with newer GCC, I don't see any newer symbols being used.

@Kobzol
Copy link
Contributor

Kobzol commented Jun 5, 2024

Thanks for checking!

I think I remembered now - the issue just was that GCC 9+ couldn't be built with GCC 4, that we use on CI. But that shouldn't be an issue for crosstool.

@XrXr
Copy link
Contributor Author

XrXr commented Jun 6, 2024

I don't know if I have permissions to do this, but I'm curious if this passes CI.

@bors try

@bors
Copy link
Contributor

bors commented Jun 6, 2024

@XrXr: 🔑 Insufficient privileges: not in try users

@Kobzol
Copy link
Contributor

Kobzol commented Jun 6, 2024

@bors try

@bors
Copy link
Contributor

bors commented Jun 6, 2024

⌛ Trying commit dca68e9 with merge 388d562...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 6, 2024
ci: use GCC 13 as cross compiler in `dist-aarch64-linux`

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 exposure to 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 builds `compiler-rt`
through 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.

Since `loongarch64-linux-gnu` already uses GCC 13.2.0, I hope we can upgrade without issues.

try-job: dist-aarch64-linux

[1]: https://github.com/rust-lang/compiler-builtins/blob/c04eb9e1afb72bdf943f5e5d77b3812f40526602/build.rs#L524-L539
@cuviper
Copy link
Member

cuviper commented Jun 6, 2024

try-job: dist-aarch64-linux

Ooh, I haven't seen that in action yet, neat!

@bors
Copy link
Contributor

bors commented Jun 6, 2024

☀️ Try build successful - checks-actions
Build commit: 388d562 (388d5626e51306c8131c8d0ac0c80a25c27a12ab)

@Kobzol
Copy link
Contributor

Kobzol commented Jun 9, 2024

CI job looked ok, and beta has just branched, so let's merge and see if it causes any problems downstream.

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Jun 9, 2024

📌 Commit dca68e9 has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 9, 2024
@bors
Copy link
Contributor

bors commented Jun 9, 2024

⌛ Testing commit dca68e9 with merge 65d1a73...

@bors
Copy link
Contributor

bors commented Jun 9, 2024

☀️ Test successful - checks-actions
Approved by: Kobzol
Pushing 65d1a73 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 9, 2024
@bors bors merged commit 65d1a73 into rust-lang:master Jun 9, 2024
7 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jun 9, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (65d1a73): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (secondary -7.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-7.5% [-7.8%, -7.3%] 3
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: missing data
Artifact size: 319.71 MiB -> 319.71 MiB (-0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants