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

1.74 fails to build on mips with LTO: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `std::collections::hash::map::RandomState::new::KEYS::__getit::__KEY' #118794

Closed
matoro opened this issue Dec 10, 2023 · 4 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries O-linux Operating system: Linux O-MIPS Target: MIPS processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matoro
Copy link

matoro commented Dec 10, 2023

Hi, 1.74 (tried 1.74.1) fails to build on mips when upgrading from 1.73.0. 1.73.0 rebuilds itself just fine. My platform is big-endian mips64.

error: linking with `mips64-unknown-linux-gnu-gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1/lib/rustlib/mips64-unknown-linux-gnuabi64/bin:/var/tmp/portage/dev-lang/rust-1.74.1/temp/python3.12/bin:/usr/lib/portage/python3.11/ebuild-helpers/xattr:/usr/lib/portage/python3.11/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin" VSLANG="1033" "mips64-unknown-linux-gnu-gcc" "-Wl,--version-script=/var/tmp/portage/dev-lang/rust-1.74.1/temp/rustcuBI7ze/list" "-Wl,--no-undefined-version" "/var/tmp/portage/dev-lang/rust-1.74.1/temp/rustcuBI7ze/symbols.o" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1-rustc/mips64-unknown-linux-gnuabi64/release/deps/rustc_driver-1db6fcb3743aba68.rustc_driver.7537d8f2e79b31eb-cgu.0.rcgu.o" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1-rustc/mips64-unknown-linux-gnuabi64/release/deps/rustc_driver-1db6fcb3743aba68.21iia6c2s8fv188.rcgu.rmeta" "-Wl,--as-needed" "-L" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1-rustc/mips64-unknown-linux-gnuabi64/release/deps" "-L" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1-rustc/release/deps" "-L" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1-rustc/mips64-unknown-linux-gnuabi64/release/build/psm-7a40414c40633d9d/out" "-L" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1-rustc/mips64-unknown-linux-gnuabi64/release/build/rustc_llvm-08caa5bd0b77bb18/out" "-L" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/llvm/build/lib" "-L" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1/lib/rustlib/mips64-unknown-linux-gnuabi64/lib" "-Wl,-Bstatic" "/var/tmp/portage/dev-lang/rust-1.74.1/temp/rustcuBI7ze/librustc_llvm-64317b9dadb2a680.rlib" "/var/tmp/portage/dev-lang/rust-1.74.1/temp/rustcuBI7ze/libpsm-0c7099f0e22d045a.rlib" "-L" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1/lib/rustlib/mips64-unknown-linux-gnuabi64/lib" "-Wl,-Bdynamic" "-lstd-3efbf6c826a525ba" "-Wl,-Bstatic" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1/lib/rustlib/mips64-unknown-linux-gnuabi64/lib/libcompiler_builtins-0a38713229dd51a8.rlib" "-Wl,-Bdynamic" "-lrt" "-ldl" "-lm" "-lz" "-lstdc++" "-ldl" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1/lib/rustlib/mips64-unknown-linux-gnuabi64/lib" "-o" "/var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1-rustc/mips64-unknown-linux-gnuabi64/release/deps/librustc_driver-1db6fcb3743aba68.so" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs"
  = note: /var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1-rustc/mips64-unknown-linux-gnuabi64/release/deps/rustc_driver-1db6fcb3743aba68.rustc_driver.7537d8f2e79b31eb-cgu.0.rcgu.o: in function `<cc::Build>::new':
          rustc_driver.7537d8f2e79b31eb-cgu.0:(.text._RNvMs4_CskPnvemPRVND_2ccNtB5_5Build3new+0x48): relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `std::collections::hash::map::RandomState::new::KEYS::__getit::__KEY'
          rustc_driver.7537d8f2e79b31eb-cgu.0:(.text._RNvMs4_CskPnvemPRVND_2ccNtB5_5Build3new+0x94): relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `std::collections::hash::map::RandomState::new::KEYS::__getit::__KEY'
          rustc_driver.7537d8f2e79b31eb-cgu.0:(.text._RNvMs4_CskPnvemPRVND_2ccNtB5_5Build3new+0x180): relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `std::collections::hash::map::RandomState::new::KEYS::__getit::__KEY'
          rustc_driver.7537d8f2e79b31eb-cgu.0:(.text._RNvMs4_CskPnvemPRVND_2ccNtB5_5Build3new+0x1f4): relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `std::collections::hash::map::RandomState::new::KEYS::__getit::__KEY'
          rustc_driver.7537d8f2e79b31eb-cgu.0:(.text._RNvMs4_CskPnvemPRVND_2ccNtB5_5Build3new+0x2c0): relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `std::collections::hash::map::RandomState::new::KEYS::__getit::__KEY'
          rustc_driver.7537d8f2e79b31eb-cgu.0:(.text._RNvMs4_CskPnvemPRVND_2ccNtB5_5Build3new+0x2e8): relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `std::collections::hash::map::RandomState::new::KEYS::__getit::__KEY'
          /var/tmp/portage/dev-lang/rust-1.74.1/work/rustc-1.74.1-src/build/mips64-unknown-linux-gnuabi64/stage1-rustc/mips64-unknown-linux-gnuabi64/release/deps/rustc_driver-1db6fcb3743aba68.rustc_driver.7537d8f2e79b31eb-cgu.0.rcgu.o: in function `crossbeam_channel::select::run_select':
          rustc_driver.7537d8f2e79b31eb-cgu.0:(.text._RNvNtCsd28hJYfFZbR_17crossbeam_channel6select10run_select+0x68): relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `crossbeam_channel::utils::shuffle::RNG::__getit::__KEY'
          rustc_driver.7537d8f2e79b31eb-cgu.0:(.text._RNvNtCsd28hJYfFZbR_17crossbeam_channel6select10run_select+0x90): relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `crossbeam_channel::utils::shuffle::RNG::__getit::__KEY'
          rustc_driver.7537d8f2e79b31eb-cgu.0:(.text._RNvNtCsd28hJYfFZbR_17crossbeam_channel6select10run_select+0x150): relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `crossbeam_channel::utils::shuffle::RNG::__getit::__KEY'
          rustc_driver.7537d8f2e79b31eb-cgu.0:(.text._RNvNtCsd28hJYfFZbR_17crossbeam_channel6select10run_select+0x314): relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `<crossbeam_channel::context::Context>::with::CONTEXT::__getit::__KEY'
          rustc_driver.7537d8f2e79b31eb-cgu.0:(.text._RNvNtCsd28hJYfFZbR_17crossbeam_channel6select10run_select+0x75c): additional relocation overflows omitted from the output
          collect2: error: ld returned 1 exit status
          

error: could not compile `rustc_driver` (lib) due to previous error

Toolchain versions: gcc 13.2.1, binutils 2.41

Complete build log (using -vvv): build.log

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 10, 2023
@Jules-Bertholet
Copy link
Contributor

Jules-Bertholet commented Dec 10, 2023

@rustbot label T-compiler O-mips O-linux A-linkage

FYI, rustc's support for this target was recently demoted to tier 3.

@rustbot rustbot added O-linux Operating system: Linux O-MIPS Target: MIPS processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-linkage Area: linking into static, shared libraries and binaries labels Dec 10, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 10, 2023
@matoro matoro changed the title 1.74 fails to build on mips: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `std::collections::hash::map::RandomState::new::KEYS::__getit::__KEY' 1.74 fails to build on mips with LTO: relocation truncated to fit: R_MIPS_TLS_GOTTPREL against `std::collections::hash::map::RandomState::new::KEYS::__getit::__KEY' Dec 23, 2023
@matoro
Copy link
Author

matoro commented Dec 23, 2023

Turns out this happens only with LTO enabled, it does not occur without. (LTO via in config.toml):

[rust]
lto = fat

matoro added a commit to matoro/gentoo that referenced this issue Dec 23, 2023
See: rust-lang/rust#118794
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Dec 23, 2023
See: rust-lang/rust#118794
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
@urosbericsyrmia
Copy link

I'm trying to reproduce the issue but to no avail. Are you still getting the same issue? Can you provide more information?
I am trying to reproduce it for mips64-unknown-linux-gnuabi64.

rustc 1.78.0-nightly (c475e2303 2024-02-28)
binary: rustc
commit-hash: c475e2303b551d726307c646181e0677af1e0069
commit-date: 2024-02-28
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

@matoro
Copy link
Author

matoro commented Mar 1, 2024

I'm trying to reproduce the issue but to no avail. Are you still getting the same issue? Can you provide more information? I am trying to reproduce it for mips64-unknown-linux-gnuabi64.

rustc 1.78.0-nightly (c475e2303 2024-02-28)
binary: rustc
commit-hash: c475e2303b551d726307c646181e0677af1e0069
commit-date: 2024-02-28
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Hey, thanks for checking this out. I just tested 1.75.0 and the issue does not occur there. Appreciate it!

@matoro matoro closed this as completed Mar 1, 2024
matoro added a commit to matoro/gentoo that referenced this issue Mar 1, 2024
See: rust-lang/rust#118794
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
matoro added a commit to matoro/gentoo that referenced this issue Mar 1, 2024
See: rust-lang/rust#118794
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
matoro added a commit to matoro/gentoo that referenced this issue Mar 1, 2024
See: rust-lang/rust#118794
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
matoro added a commit to matoro/gentoo that referenced this issue Mar 1, 2024
See: rust-lang/rust#118794
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
matoro added a commit to matoro/gentoo that referenced this issue Mar 1, 2024
See: rust-lang/rust#118794
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
matoro added a commit to matoro/gentoo that referenced this issue Mar 1, 2024
See: rust-lang/rust#118794
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Mar 1, 2024
See: rust-lang/rust#118794
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries O-linux Operating system: Linux O-MIPS Target: MIPS processors T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants