mirror of
https://github.com/golang/go
synced 2024-11-11 20:50:23 -07:00
f1778c28a9
Change the run.go driver to recognize the "gc" build tag. Change existing tests to use the "gc" build tag if they use some feature that seems specific to the gc compiler, such as passing specific options to or expecting specific behavior from "go tool compile". Change tests to use the "!gccgo" build tag if they use "go build" or "go run", as while those might work with compilers other than gc, they won't work with the way that gccgo runs its testsuite (which happens independently of the go command). For #43252 Change-Id: I666e04b6d7255a77dfc256ee304094e3a6bb15ad Reviewed-on: https://go-review.googlesource.com/c/go/+/279052 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
35 lines
810 B
Go
35 lines
810 B
Go
// +build linux,!ppc64,!riscv64,gc
|
|
// run
|
|
|
|
// Copyright 2015 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Test that a -B option is passed through when using both internal
|
|
// and external linking mode.
|
|
|
|
// TODO(jsing): Re-enable on riscv64 when it has support for external
|
|
// linking - see golang.org/issue/36739
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/exec"
|
|
"path/filepath"
|
|
)
|
|
|
|
func main() {
|
|
test("internal")
|
|
test("external")
|
|
}
|
|
|
|
func test(linkmode string) {
|
|
out, err := exec.Command("go", "run", "-ldflags", "-B=0x12345678 -linkmode="+linkmode, filepath.Join("fixedbugs", "issue10607a.go")).CombinedOutput()
|
|
if err != nil {
|
|
fmt.Printf("BUG: linkmode=%s %v\n%s\n", linkmode, err, out)
|
|
os.Exit(1)
|
|
}
|
|
}
|