rust-lang / rust-lang/rustc_codegen_gcc

Another problem with Windows target and `compiler_builtins`

Open
#801 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.2k
Forks
105
Avg merge
8h 20m
Merged PRs (30d)
14

Description

Cloned latest Rust,ran ./x build with the following bootstrap.toml

profile = "dist"  
change-id = 148636

[build]
build-stage = 1
target = ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-gnu"]

[rust]
codegen-backends = ["gcc"]  

[target.x86_64-pc-windows-gnu]
cc = "x86_64-w64-mingw32-gcc"
cxx = "x86_64-w64-mingw32-g++"
ar = "x86_64-w64-mingw32-ar"
ranlib = "x86_64-w64-mingw32-ranlib"
linker = "x86_64-w64-mingw32-gcc"

and resulted in:

Building stage1 library artifacts{alloc, compiler_builtins, core, panic_abort, panic_unwind, proc_macro, rustc-std-workspace-core, std, std_detect, sysroot, test, unwind} (stage1:x86_64-unknown-linux-gnu -> stage1:x86_64-pc-windows-gnu)
.......(lots of messages)
/tmp/libgccjit-yPspPh/fake.s: Assembler messages:
/tmp/libgccjit-yPspPh/fake.s:51: fatal error: bad .section directive: want a,l,w,x,M,S,G,T in string
libgccjit.so: error: : error invoking gcc driver
error: failed to build archive at `(rust project dir)/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-pc-windows-gnu/release/deps/libcompiler_builtins-4c849587cc5e14fa.rlib`: failed to open object file: no such file or directory (os error 2)

I've learned the bad .section directive error may be caused by invoking a Linux targeted gcc against a Windows .s file, but I don't understand the detail since I've specified linker = "x86_64-w64-mingw32-gcc" already.

By the way, How to keep temporary file(s) of compilation such as /tmp/libgccjit-yPspPh/fake.s ? They simply vanished when I am to inspect them.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing ./x build with the reported bootstrap.toml and inspect the compiler_builtins failure for the x86_64-pc-windows-gnu target. Investigate how the temporary fake.s file is assembled and whether the configured linker is used; done means identifying the cause of the bad section directive and defining a verified fix or clear reproduction details.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.