1// run 2 3//go:build linux && !ppc64 && gc && cgo 4 5// Copyright 2015 The Go Authors. All rights reserved. 6// Use of this source code is governed by a BSD-style 7// license that can be found in the LICENSE file. 8 9// Test that a -B option is passed through when using both internal 10// and external linking mode. 11 12package main 13 14import ( 15 "fmt" 16 "os" 17 "os/exec" 18 "path/filepath" 19) 20 21func main() { 22 test("internal") 23 test("external") // The 'cgo' build constraint should imply that a linker is available. 24} 25 26func test(linkmode string) { 27 out, err := exec.Command("go", "run", "-ldflags", "-B=0x12345678 -linkmode="+linkmode, filepath.Join("fixedbugs", "issue10607a.go")).CombinedOutput() 28 if err != nil { 29 fmt.Printf("BUG: linkmode=%s %v\n%s\n", linkmode, err, out) 30 os.Exit(1) 31 } 32} 33