Bug 124212 - jobserver token isn't preserved
Summary: jobserver token isn't preserved
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: driver (show other bugs)
Version: 16.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: lto
Depends on:
Blocks:
 
Reported: 2026-02-23 11:16 UTC by Sam James
Modified: 2026-10-01 09:14 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2026-02-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James 2026-02-23 11:16:26 UTC
gcc's jobserver_info in gcc/opts-jobserver.h doesn't record the token received.

In gcc/opts-common.cc:
```
void
jobserver_info::return_token ()
{
  int fd = pipe_path.empty () ? wfd : pipefd;
  char c = 'G';
  int res = write (fd, &c, 1);
  gcc_assert (res == 1);
}
```

Per https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html, clients should return the exact token they received, not uniformly 'G':

"""
It’s important that when you release the job slot, you write back the same character you read. Don’t assume that all tokens are the same character; different characters may have different meanings to GNU make. The order is not important, since make has no idea in what order jobs will complete anyway. 
"""
Comment 1 Sam James 2026-02-23 11:18:48 UTC
(This isn't completely academic, as we have at least one jobserver impl that cares about the token and wants to use it for accounting, and currently warns on a mismatch.)
Comment 2 Richard Biener 2026-02-23 12:20:36 UTC
Confirmed.