aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm/internal/lex/input.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2023-08-26 19:06:33 -0700
committerGopher Robot <gobot@golang.org>2023-08-29 07:48:38 +0000
commiteaae2d45c76d2d27e1b4c39ba57dd1582ab26491 (patch)
tree956a7ba7e6a51bf3dad503d1f1b5eacf8763388f /src/cmd/asm/internal/lex/input.go
parentf7f1c4f86d72bac49cfd30fc94ec62756d951245 (diff)
downloadgo-eaae2d45c76d2d27e1b4c39ba57dd1582ab26491.tar.xz
cmd: simplify some handling of package paths
We have obj.Link.Pkgpath, so we don't need to pass it redundantly in places where we already have an *obj.Link. Also, renaming the parser's "compilingRuntime" field to "allowABI", to match the "AllowAsmABI" name used by objabi.LookupPkgSpecial. Finally, push the handling of GOEXPERIMENT_* flags up to cmd/asm's main entry point, by simply appending them to flags.D. Change-Id: I6ada134522b0cbc90d35bcb145fbe045338fefb7 Reviewed-on: https://go-review.googlesource.com/c/go/+/523297 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/asm/internal/lex/input.go')
-rw-r--r--src/cmd/asm/internal/lex/input.go22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/cmd/asm/internal/lex/input.go b/src/cmd/asm/internal/lex/input.go
index 3034377793..da4ebe6d6e 100644
--- a/src/cmd/asm/internal/lex/input.go
+++ b/src/cmd/asm/internal/lex/input.go
@@ -6,7 +6,6 @@ package lex
import (
"fmt"
- "internal/buildcfg"
"os"
"path/filepath"
"strconv"
@@ -34,33 +33,18 @@ type Input struct {
}
// NewInput returns an Input from the given path.
-func NewInput(name string, compilingRuntime bool) *Input {
+func NewInput(name string) *Input {
return &Input{
// include directories: look in source dir, then -I directories.
includes: append([]string{filepath.Dir(name)}, flags.I...),
beginningOfLine: true,
- macros: predefine(flags.D, compilingRuntime),
+ macros: predefine(flags.D),
}
}
// predefine installs the macros set by the -D flag on the command line.
-func predefine(defines flags.MultiFlag, compilingRuntime bool) map[string]*Macro {
+func predefine(defines flags.MultiFlag) map[string]*Macro {
macros := make(map[string]*Macro)
-
- // Set macros for GOEXPERIMENTs so we can easily switch
- // runtime assembly code based on them.
- if compilingRuntime {
- for _, exp := range buildcfg.Experiment.Enabled() {
- // Define macro.
- name := "GOEXPERIMENT_" + exp
- macros[name] = &Macro{
- name: name,
- args: nil,
- tokens: Tokenize("1"),
- }
- }
- }
-
for _, name := range defines {
value := "1"
i := strings.IndexRune(name, '=')