bazelbuild / bazelbuild/bazel

Add custom `additional_outputs` to `cc_common.link`

Open
#24,990 5 comments 1 reaction 0 assignees View on GitHub
P3 stale team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

We have a custom toolchain that outputs more than one file in the linking action. We would like to access these files later in the build process.
Today we have no way of accessing these files because bazel doesn't declare them as outputs of the linking action.

ideally these additional output files would be taken from a definition in the cc toolchain.

### Which category does this issue belong to?

C++ Rules

### What underlying problem are you trying to solve with this feature?

Retrieve additional (non-standard) output files from the sandbox when compiling via `cc_common.link`

### Which operating system are you running Bazel on?

Linux

### What is the output of `bazel info release`?

release 7.4.1

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse HEAD` ?

```text

```

### Have you found anything relevant by searching the web?

I have found this issue: https://github.com/bazelbuild/bazel/issues/22036 which asks for something very similar but for `cc_common.compile`

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reading the cc_common.link entry point and the C++ toolchain definition, focusing on how linking outputs are declared. Compare the requested behavior with issue #22036 for cc_common.compile. Done means additional toolchain-produced files are declared by the linking action and can be retrieved later in the build.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.