Skip to content

tests/run-make/link-eh-frame-terminator/rmake.rs recipe fails during test run for link-eh-frame-terminator on riscv64 target in x86 QEMU environment #143726

Open
@CaiWeiran

Description

@CaiWeiran

Description:
I am encountering an issue while running the official CI tests on a riscv64gc-unknown-linux-gnu target in an x86_64 QEMU environment. The test [run-make] tests/run-make/link-eh-frame-terminator fails during the linking stage with the error: Relocations in generic ELF (EM: 243) and error adding symbols: file in wrong format. The test fails when linking with cc.

Steps to Reproduce:

  1. Run the command: python3 ./x.py --stage 2 test --host='' --target riscv64gc-unknown-linux-gnu tests/run-make/link-eh-frame-terminator/rmake.rs in a QEMU environment with an x86_64 host and a riscv64gc-unknown-linux-gnu target.
  2. Observe the error message during the test execution.

Error Output:

``` [TIMING] core::build_steps::tool::Rustdoc { compiler: Compiler { stage: 2, host: x86_64-unknown-linux-gnu, forced_compiler: false } } -- 0.058 Testing stage2 compiletest suite=run-make mode=run-make (x86_64-unknown-linux-gnu -> riscv64gc-unknown-linux-gnu)

running 1 tests
test [run-make] tests/run-make/link-eh-frame-terminator ... FAILED

failures:

---- [run-make] tests/run-make/link-eh-frame-terminator stdout ----

error: rmake recipe failed to complete
status: exit status: 1
command: cd "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/link-eh-frame-terminator/rmake_out" && env -u RUSTFLAGS AR="riscv64-linux-gnu-ar" BUILD_ROOT="/checkout/obj/build/x86_64-unknown-linux-gnu" CARGO="/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/cargo" CC="riscv64-linux-gnu-gcc" CC_DEFAULT_FLAGS="-ffunction-sections -fdata-sections -fPIC -march=rv64gc -mabi=lp64d" CXX="riscv64-linux-gnu-g++" CXX_DEFAULT_FLAGS="-ffunction-sections -fdata-sections -fPIC -march=rv64gc -mabi=lp64d" HOST_RUSTC_DYLIB_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib" LD_LIB_PATH_ENVVAR="LD_LIBRARY_PATH" LLVM_BIN_DIR="/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/bin" LLVM_COMPONENTS="aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgputargetmca amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard cgdata codegen codegentypes core coroutines coverage csky cskyasmparser cskycodegen cskydesc cskydisassembler cskyinfo debuginfobtf debuginfocodeview debuginfodwarf debuginfogsym debuginfologicalview debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwarflinkerclassic dwarflinkerparallel dwp engine executionengine extensions filecheck frontendatomic frontenddriver frontendhlsl frontendoffloading frontendopenacc frontendopenmp fuzzercli fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo hipstdpar instcombine instrumentation interfacestub interpreter ipo irprinter irreader jitlink libdriver lineeditor linker loongarch loongarchasmparser loongarchcodegen loongarchdesc loongarchdisassembler loongarchinfo lto m68k m68kasmparser m68kcodegen m68kdesc m68kdisassembler m68kinfo mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts objcopy object objectyaml option orcdebugging orcjit orcshared orctargetprocess passes powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvtargetmca runtimedyld sandboxir scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target targetparser telemetry textapi textapibinaryreader transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo webassemblyutils windowsdriver windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86targetmca xray xtensa xtensaasmparser xtensacodegen xtensadesc xtensadisassembler xtensainfo" LLVM_FILECHECK="/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" PYTHON="/usr/bin/python3" REMOTE_TEST_CLIENT="/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/remote-test-client" RUSTC="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" RUSTC_LINKER="riscv64-linux-gnu-gcc" RUSTDOC="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" SOURCE_ROOT="/checkout" TARGET="riscv64gc-unknown-linux-gnu" TARGET_EXE_DYLIB_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/riscv64gc-unknown-linux-gnu/lib" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/link-eh-frame-terminator/rmake"
stdout: none
--- stderr -------------------------------
command failed at line 16
Command { cmd: LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/link-eh-frame-terminator/rmake_out:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/link-eh-frame-terminator/rmake_out" "eh_frame-terminator.rs" "--target=riscv64gc-unknown-linux-gnu", stdin_buf: None, stdin: None, stdout: None, stderr: None, drop_bomb: DropBomb { command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc", defused: true, armed_location: Location { file: "/checkout/tests/run-make/link-eh-frame-terminator/rmake.rs", line: 16, column: 5 } }, already_executed: true }
output status: exit status: 1
=== STDOUT ===

=== STDERR ===
error: linking with cc failed: exit status: 1
|
= note: "cc" "/tmp/rustcKqaLCI/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/lib/rustlib/riscv64gc-unknown-linux-gnu/lib/{libstd-,libpanic_unwind-,libobject-,libmemchr-,libaddr2line-,libgimli-,librustc_demangle-,libstd_detect-,libhashbrown-,librustc_std_workspace_alloc-,libminiz_oxide-,libadler2-,libunwind-,libcfg_if-,liblibc-,librustc_std_workspace_core-,liballoc-,libcore-,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcKqaLCI/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/link-eh-frame-terminator/rmake_out" "-L" "/lib/rustlib/riscv64gc-unknown-linux-gnu/lib" "-o" "eh_frame-terminator" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: some arguments are omitted. use --verbose to show all linker arguments
= note: /usr/bin/ld: eh_frame-terminator.eh_frame_terminator.de96000750278472-cgu.0.rcgu.o: Relocations in generic ELF (EM: 243)
...

```

Expected Behavior:
The test should pass successfully, and the linker should handle the target architecture properly.

Environment:

  • Rust version: 1.88.0 (Lastet)
  • Target architecture: riscv64gc-unknown-linux-gnu
  • Host architecture: x86_64-unknown-linux-gnu (QEMU)
  • Operating System: Ubuntu 20.04

Additional Information:

  • When running the same test in a native riscv64 environment (not under QEMU), the test passes successfully without any errors.
  • This issue specifically occurs in the emulated QEMU environment when linking with riscv64-linux-gnu-gcc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-run-makeArea: port run-make Makefiles to rmake.rsC-bugCategory: This is a bug.O-riscvTarget: RISC-V architectureneeds-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions