Skip to content

Invalid compiler_builtins produced for loongarch64-unknown-none #125908

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ghost opened this issue Jun 3, 2024 · 1 comment · Fixed by #127150
Closed

Invalid compiler_builtins produced for loongarch64-unknown-none #125908

ghost opened this issue Jun 3, 2024 · 1 comment · Fixed by #127150
Labels
A-CI Area: Our Github Actions CI C-bug Category: This is a bug. O-loongarch Target: LoongArch (LA32R, LA32S, LA64) T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@ghost
Copy link

ghost commented Jun 3, 2024

When downloading the loongarch64-unknown-none (and softfloat variant) target, the compiler_builtins that ships with the compiler is broken:

error: linking with `rust-lld` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="<redacted>" VSLANG="1033" "rust-lld" "-flavor" "gnu" "/tmp/rustca1ZUz1/symbols.o" "/tmp/example/target/loongarch64-unknown-none-softfloat/debug/deps/example-43ca1a05d5214464.2dsfu9v1nhu5h7yb.rcgu.o" "--as-needed" "-L" "/tmp/example/target/loongarch64-unknown-none-softfloat/debug/deps" "-L" "/tmp/example/target/debug/deps" "-L" "/tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib" "-Bstatic" "/tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/librustc_std_workspace_core-a66f3359610045a1.rlib" "/tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcore-fd043e39f63b431a.rlib" "/tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib" "-Bdynamic" "--eh-frame-hdr" "-z" "noexecstack" "-L" "/tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib" "-o" "/tmp/example/target/loongarch64-unknown-none-softfloat/debug/deps/example-43ca1a05d5214464" "--gc-sections"
  = note: rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-absvdi2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-absvsi2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-absvti2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-addvdi3.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-addvsi3.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-addvti3.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-clzdi2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-clzsi2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-clzti2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-cmpdi2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-cmpti2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-ctzdi2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-ctzsi2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-ctzti2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-divdc3.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-divsc3.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-extendhfsf2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-ffsti2.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-int_util.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: /tmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/loongarch64-unknown-none-softfloat/lib/libcompiler_builtins-811e50dbc3f2e3d8.rlib(45c91108d938afe8-muldc3.o) is incompatible with /tmp/rustca1ZUz1/symbols.o
          rust-lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)

Upon further inspection, the compiler_builtins symbols are indeed built for x86-64 and not LoongArch:

$ file 45c91108d938afe8-muldc3.o
45c91108d938afe8-muldc3.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), with debug_info, not stripped

It's not clear what causes this, but https://github.com/rust-lang/rust/blob/master/src/ci/docker/host-x86_64/dist-various-2/Dockerfile#L33 contains no corresponding definitions for CC_.

This issue appears related, in that it would catch whatever causes this: #111142

@ghost ghost added the C-bug Category: This is a bug. label Jun 3, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 3, 2024
@workingjubilee
Copy link
Member

cc @heiher @xen0n

@workingjubilee workingjubilee added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-CI Area: Our Github Actions CI O-loongarch Target: LoongArch (LA32R, LA32S, LA64) T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 3, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 30, 2024
Fix x86_64 code being produced for bare-metal LoongArch targets' `compiler_builtins`

Formerly the `loongarch*-*-none*` targets were added to the `dist-various-2` CI job, but no corresponding toolchain was added along with them. This meant the `compiler_builtins` for the targets were built with the host toolchain.

As the other `dist-various` toolchains are mostly pre-built so far, to avoid burdening them with crosstool-ng builds, simply move the two bare-metal LoongArch targets to the `dist-loongarch64-linux` job which has a ready-to-use LoongArch toolchain. With the proper CFLAGS applied it is possible to build artifacts suitable for bare-metal. I verified that the `compiler_builtins` objects are now correctly produced regarding architecture and ABI, with the changes here applied.

Fixes rust-lang#125908.

cc `@heiher`

try-job: dist-loongarch64-linux
try-job: dist-various-2
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 1, 2024
Fix x86_64 code being produced for bare-metal LoongArch targets' `compiler_builtins`

Formerly the `loongarch*-*-none*` targets were added to the `dist-various-2` CI job, but no corresponding toolchain was added along with them. This meant the `compiler_builtins` for the targets were built with the host toolchain.

As the other `dist-various` toolchains are mostly pre-built so far, to avoid burdening them with crosstool-ng builds, simply move the two bare-metal LoongArch targets to the `dist-loongarch64-linux` job which has a ready-to-use LoongArch toolchain. With the proper CFLAGS applied it is possible to build artifacts suitable for bare-metal. I verified that the `compiler_builtins` objects are now correctly produced regarding architecture and ABI, with the changes here applied.

Fixes rust-lang#125908.

cc `@heiher`

try-job: dist-loongarch64-linux
try-job: dist-various-2
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 1, 2024
Fix x86_64 code being produced for bare-metal LoongArch targets' `compiler_builtins`

Formerly the `loongarch*-*-none*` targets were added to the `dist-various-2` CI job, but no corresponding toolchain was added along with them. This meant the `compiler_builtins` for the targets were built with the host toolchain.

As the other `dist-various` toolchains are mostly pre-built so far, to avoid burdening them with crosstool-ng builds, simply move the two bare-metal LoongArch targets to the `dist-loongarch64-linux` job which has a ready-to-use LoongArch toolchain. With the proper CFLAGS applied it is possible to build artifacts suitable for bare-metal. I verified that the `compiler_builtins` objects are now correctly produced regarding architecture and ABI, with the changes here applied.

Fixes rust-lang#125908.

cc ``@heiher``

try-job: dist-loongarch64-linux
try-job: dist-various-2
@bors bors closed this as completed in 03fce36 Jul 1, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 1, 2024
Rollup merge of rust-lang#127150 - xen0n:issue125908, r=Kobzol

Fix x86_64 code being produced for bare-metal LoongArch targets' `compiler_builtins`

Formerly the `loongarch*-*-none*` targets were added to the `dist-various-2` CI job, but no corresponding toolchain was added along with them. This meant the `compiler_builtins` for the targets were built with the host toolchain.

As the other `dist-various` toolchains are mostly pre-built so far, to avoid burdening them with crosstool-ng builds, simply move the two bare-metal LoongArch targets to the `dist-loongarch64-linux` job which has a ready-to-use LoongArch toolchain. With the proper CFLAGS applied it is possible to build artifacts suitable for bare-metal. I verified that the `compiler_builtins` objects are now correctly produced regarding architecture and ABI, with the changes here applied.

Fixes rust-lang#125908.

cc ``@heiher``

try-job: dist-loongarch64-linux
try-job: dist-various-2
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-CI Area: Our Github Actions CI C-bug Category: This is a bug. O-loongarch Target: LoongArch (LA32R, LA32S, LA64) T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants