Rust-GCC / Rust-GCC/gccrs

Pass configuration flags to `cargo`

Open
#2,899 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

misc upstream
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

As of #2822 "Start reusing rustc's format_args parser", we invoke cargo to produce object files to be linked into GCC. We currently don't specify any compilation flags and linker to use, so it's easy to run into mismatches between what GCC is configured for (for example, specific linker), and what cargo uses by default (for example, system cc for linking).

For example, the linker may be specified: https://doc.rust-lang.org/cargo/reference/config.html#targettriplelinker -- but do we need the Rust target triple for that (see #2898)? Trying to use a cfg() expressions à la --config "target.'cfg(all())'.linker=[...]" only produces:

warning: unused key `linker` in [target] config table `cfg(all())`

(Maybe I've misunderstood how that is to be used.)

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 inspecting the cargo invocation introduced by #2822 and compare it with the Rust target-triple questions in #2898. Read Cargo's target linker configuration documentation linked in the issue. Done means cargo receives the relevant compilation flags and linker settings used by GCC's configuration, avoiding mismatches.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.