Skip to content

Commit

Permalink
cmd/asm: rename -symabis to -gensymabis
Browse files Browse the repository at this point in the history
Currently, both asm and compile have a -symabis flag, but in asm it's
a boolean flag that means to generate a symbol ABIs file and in the
compiler its a string flag giving the path of the symbol ABIs file to
consume. I'm worried about this false symmetry biting us in the
future, so rename asm's flag to -gensymabis.

Updates #27539.

Change-Id: I8b9c18a852d2838099718f8989813f19d82e7434
Reviewed-on: https://go-review.googlesource.com/c/149818
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
aclements committed Nov 16, 2018
1 parent 6f5be37 commit 3faab79
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/cmd/asm/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Flags:
Generate code that can be linked into a shared library.
-trimpath prefix
Remove prefix from recorded source file paths.
-gensymabis
Write symbol ABI information to output file. Don't assemble.
Input language:
The assembler uses mostly the same syntax for all architectures,
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/asm/internal/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (
Shared = flag.Bool("shared", false, "generate code that can be linked into a shared library")
Dynlink = flag.Bool("dynlink", false, "support references to Go symbols defined in other shared libraries")
AllErrors = flag.Bool("e", false, "no limit on number of errors reported")
SymABIs = flag.Bool("symabis", false, "write symbol ABI information to output file, don't assemble")
SymABIs = flag.Bool("gensymabis", false, "write symbol ABI information to output file, don't assemble")
)

var (
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/dist/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ func runInstall(dir string, ch chan struct{}) {
if len(sfiles) > 0 {
symabis = pathf("%s/symabis", workdir)
var wg sync.WaitGroup
asmabis := append(asmArgs[:len(asmArgs):len(asmArgs)], "-symabis", "-o", symabis)
asmabis := append(asmArgs[:len(asmArgs):len(asmArgs)], "-gensymabis", "-o", symabis)
asmabis = append(asmabis, sfiles...)
if err := ioutil.WriteFile(goasmh, nil, 0666); err != nil {
fatalf("cannot write empty go_asm.h: %s", err)
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/go/internal/work/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (gcToolchain) asm(b *Builder, a *Action, sfiles []string) ([]string, error)
func (gcToolchain) symabis(b *Builder, a *Action, sfiles []string) (string, error) {
mkSymabis := func(p *load.Package, sfiles []string, path string) error {
args := asmArgs(a, p)
args = append(args, "-symabis", "-o", path)
args = append(args, "-gensymabis", "-o", path)
for _, sfile := range sfiles {
if p.ImportPath == "runtime/cgo" && strings.HasPrefix(sfile, "gcc_") {
continue
Expand All @@ -274,7 +274,7 @@ func (gcToolchain) symabis(b *Builder, a *Action, sfiles []string) (string, erro
}

// Supply an empty go_asm.h as if the compiler had been run.
// -symabis parsing is lax enough that we don't need the
// -gensymabis parsing is lax enough that we don't need the
// actual definitions that would appear in go_asm.h.
if err := b.writeFile(a.Objdir+"go_asm.h", nil); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion test/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ func (t *test) run() {
t.err = fmt.Errorf("write empty go_asm.h: %s", err)
return
}
cmd := []string{goTool(), "tool", "asm", "-symabis", "-o", "symabis"}
cmd := []string{goTool(), "tool", "asm", "-gensymabis", "-o", "symabis"}
cmd = append(cmd, asms...)
_, err = runcmd(cmd...)
if err != nil {
Expand Down

0 comments on commit 3faab79

Please sign in to comment.