diff options
| author | Corentin Kerisit <corentin.kerisit@gmail.com> | 2026-02-13 21:51:01 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-03-06 12:16:24 -0800 |
| commit | 8933fb98f309443a5ca3aeda2163017737dbe795 (patch) | |
| tree | e6bde20fbae3c03dfe318b47d7a34562133c3132 /src | |
| parent | cb41169895369f6681a7029e29cfa6a4f300e2d4 (diff) | |
| download | go-8933fb98f309443a5ca3aeda2163017737dbe795.tar.xz | |
cmd/link: allow -no family of flags for testing compiler flag
This changes modifies Go to allow the -nostdlib++ flag to the list of
allowed flags to be passed to the c compiler invocation when testing flags
in cmd/link.
It is similar to #76858 and complements #76825.
This is needed for hermetic c only toolchains where -nostdlib++ is passed
transitively.
Given prior discussions about security considerations when adding flags to
the whitelist, this particular one may be particularly safe to whitelist.
Change-Id: If2e295f9de544b4498ad37fb07d3f7b3b11bbf6d
GitHub-Last-Rev: e59fd659d7e7e2e057bbb29e5ae12b0fa11fdb60
GitHub-Pull-Request: golang/go#77601
Reviewed-on: https://go-review.googlesource.com/c/go/+/745340
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/link/internal/ld/lib.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index 896507cb34..64fd4cc89e 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -2274,6 +2274,13 @@ func trimLinkerArgv(argv []string) []string { "--stdlib", "-unwindlib", "--unwindlib", + "-nostdlib++", + "-nostdlib", + "-nodefaultlibs", + "-nostartfiles", + "-nostdinc++", + "-nostdinc", + "-nobuiltininc", } var flags []string |
