Skip to content

lint-docs fails its tests in a cross-compiling environment #129956

Closed

Description

Description

Currently, lint-docs doesn't detect or use the linker option bootstrap has. This causes rustc to use the wrong linker when running lint-docs for a foreign target.

I tried this code:

cat > config.toml << 'EOF'
[llvm]
download-ci-llvm = true

[rust]
debug = false
debuginfo-level = 0
deny-warnings = false
parallel-compiler = false

[build]
target = ["aarch64-unknown-linux-gnu"]
host = ["aarch64-unknown-linux-gnu"]
extended = true
tools = ["cargo", "rustfmt", "rustdoc", "rust-analyzer-proc-macro-srv"]
EOF
./x.py test src/tools/lint-docs

I expected to see this happen:

the test should complete successfully

Instead, this happened:

error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin:/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin:/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "cc" "/tmp/rustc7SdjrZ/symbols.o" "lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o" "lint_example.30n99m0wmvpbs2ttsaf6l8qgp.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd-d03532c057d00a3f.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libpanic_unwind-3d0de4e3fa9bbd8a.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libobject-62590d15ce0c75d4.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libmemchr-e5b7cea9b3f74463.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libaddr2line-a96b2a6d932eeacd.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libgimli-37fe99ea887d359c.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_demangle-6aea647da60f5d56.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd_detect-066bd40bba4f0f1c.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libhashbrown-df0cacc3519fb3e8.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-eb9b6fda793a42e8.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libminiz_oxide-35465fa51f1203f9.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libadler-deb47ddfa7d4c793.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libunwind-e2effffda4bc7106.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcfg_if-c1eadd4c4bf236fc.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/liblibc-1f258c784570b7d2.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/liballoc-404257254a09efc3.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/librustc_std_workspace_core-66ec4246aee3d3e5.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcore-68ec090f3319860e.rlib" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-72679d50ff21414a.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/ws/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "lint_example" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: Relocations in generic ELF (EM: 183)
          /usr/bin/ld: lint_example.lint_example.a902ba3ee19f1053-cgu.0.rcgu.o: error adding symbols: file in wrong format
          collect2: error: ld returned 1 exit status
          


error: aborting due to 1 previous error

Meta

rustc commit:

d6c8169c186ab16a3404cd0d0866674018e8a19e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions