summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-16 17:39:55 -0400
committerRuss Cox <rsc@golang.org>2014-09-16 17:39:55 -0400
commit49f4c39e491fe81c849d206d91e47b8a757b232a (patch)
treebb226f52c46ce72ead725a9d047755cd3d0fe095 /test
parentb8bda7526a56e959b2aade18c392fb6e4d39e7b5 (diff)
downloadgo-49f4c39e491fe81c849d206d91e47b8a757b232a.tar.gz
liblink: make GO_ARGS the default for functions beginning with ?
If there is a leading ?, assume there is a Go prototype and attach the Go prototype information to the function. If the function is not called from Go and does not need a Go prototype, it can be made file-local instead (using name<>(SB)). This fixes the current BSD build failures, by giving functions like sync/atomic.StoreUint32 argument stack map information. Fixes issue 8753. LGTM=khr, iant R=golang-codereviews, iant, khr, bradfitz CC=golang-codereviews, r, rlh https://codereview.appspot.com/142150043
Diffstat (limited to 'test')
-rw-r--r--test/nosplit.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/nosplit.go b/test/nosplit.go
index c9d008acd..953a5bf0a 100644
--- a/test/nosplit.go
+++ b/test/nosplit.go
@@ -12,6 +12,7 @@ import (
"bytes"
"fmt"
"io/ioutil"
+ "log"
"os"
"os/exec"
"path/filepath"
@@ -190,7 +191,6 @@ func main() {
return
}
defer os.RemoveAll(dir)
- ioutil.WriteFile(filepath.Join(dir, "main.go"), []byte("package main\nfunc main()\n"), 0666)
tests = strings.Replace(tests, "\t", " ", -1)
tests = commentRE.ReplaceAllString(tests, "")
@@ -230,6 +230,9 @@ TestCases:
continue
}
+ var gobuf bytes.Buffer
+ fmt.Fprintf(&gobuf, "package main\n")
+
var buf bytes.Buffer
if goarch == "arm" {
fmt.Fprintf(&buf, "#define CALL BL\n#define REGISTER (R0)\n")
@@ -277,11 +280,17 @@ TestCases:
body = callRE.ReplaceAllString(body, "CALL ·$1(SB);")
body = callindRE.ReplaceAllString(body, "CALL REGISTER;")
+ fmt.Fprintf(&gobuf, "func %s()\n", name)
fmt.Fprintf(&buf, "TEXT ·%s(SB)%s,$%d-0\n\t%s\n\tRET\n\n", name, nosplit, size, body)
}
}
- ioutil.WriteFile(filepath.Join(dir, "asm.s"), buf.Bytes(), 0666)
+ if err := ioutil.WriteFile(filepath.Join(dir, "asm.s"), buf.Bytes(), 0666); err != nil {
+ log.Fatal(err)
+ }
+ if err := ioutil.WriteFile(filepath.Join(dir, "main.go"), gobuf.Bytes(), 0666); err != nil {
+ log.Fatal(err)
+ }
cmd := exec.Command("go", "build")
cmd.Dir = dir