]> Cypherpunks repositories - gostls13.git/commit
cmd/compile,cmd/dist,cmd/go: compute -+ flag from package path
authorAustin Clements <austin@google.com>
Fri, 30 Jun 2023 20:33:49 +0000 (16:33 -0400)
committerAustin Clements <austin@google.com>
Tue, 22 Aug 2023 19:18:28 +0000 (19:18 +0000)
commitfbcf43c60ba5170309a238b0e42fd5879d419776
treee3e2272ba47c261aeaff37dd230bd1873eb51b28
parent88a6df72c9c056559bda14d88252ba350949bf50
cmd/compile,cmd/dist,cmd/go: compute -+ flag from package path

As we did for the asm -compiling-runtime flag, this CL modifies the
compiler to compute the -+ (compiling runtime) flag from the package
path. Unlike for asm, some tests use -+ explicitly to opt in to
runtime restrictions, so we leave the flag, but it's no longer passed
by any build tools.

This lets us eliminate cmd/go's list of "runtime packages" in favor of
the unified objabi.LookupPkgSpecial. It also fixes an inconsistency
with dist, which only passed -+ when compiling "runtime" itself.

One consequence of this is that the compiler now ignores the -N flag
when compiling runtime packages. Previously, cmd/go would strip -N
when passing -+ and the compiler would fatal if it got both -N and -+,
so the overall effect was that the compiler never saw -N when
compiling a runtime package. Now we simply move that logic to disable
-N down into the compiler.

Change-Id: I4876047a1563210ed122a31b72d62798762cbcf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/521699
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/base/flag.go
src/cmd/dist/build.go
src/cmd/go/internal/work/gc.go
src/cmd/internal/objabi/pkgspecial.go