aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/nm
diff options
context:
space:
mode:
authorClément Chigot <clement.chigot@atos.net>2019-02-21 10:50:29 +0100
committerIan Lance Taylor <iant@golang.org>2019-03-20 13:50:44 +0000
commit1b5b08d10a372ef3e3a21442fade2d2b4e3be343 (patch)
treea3b35fc6ab400838e575805b2c57b731964f1f74 /src/cmd/nm
parentb41eef244319df4f7431728ac7671cdbe8449778 (diff)
downloadgo-1b5b08d10a372ef3e3a21442fade2d2b4e3be343.tar.gz
go-1b5b08d10a372ef3e3a21442fade2d2b4e3be343.zip
cmd/nm: fix cgo tests for aix/ppc64
This commit handles AIX cgo in cmd/nm tests. Change-Id: I6753a0102e4f2c4c7bd4d7c999f62a0cb3d2183c Reviewed-on: https://go-review.googlesource.com/c/go/+/164017 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/nm')
-rw-r--r--src/cmd/nm/nm_cgo_test.go2
-rw-r--r--src/cmd/nm/nm_test.go11
2 files changed, 13 insertions, 0 deletions
diff --git a/src/cmd/nm/nm_cgo_test.go b/src/cmd/nm/nm_cgo_test.go
index 1dfdf7f21a..143a297e05 100644
--- a/src/cmd/nm/nm_cgo_test.go
+++ b/src/cmd/nm/nm_cgo_test.go
@@ -20,6 +20,8 @@ func canInternalLink() bool {
case "arm64", "mips64", "mips64le", "mips", "mipsle", "ppc64", "ppc64le":
return false
}
+ case "aix":
+ return false
}
return true
}
diff --git a/src/cmd/nm/nm_test.go b/src/cmd/nm/nm_test.go
index 8176ddd7f4..e47d57d9cb 100644
--- a/src/cmd/nm/nm_test.go
+++ b/src/cmd/nm/nm_test.go
@@ -136,6 +136,11 @@ func testGoExec(t *testing.T, iscgo, isexternallinker bool) {
"runtime.noptrdata": "D",
}
+ if runtime.GOOS == "aix" && iscgo {
+ // pclntab is moved to .data section on AIX.
+ runtimeSyms["runtime.epclntab"] = "D"
+ }
+
out, err = exec.Command(testnmpath, exe).CombinedOutput()
if err != nil {
t.Fatalf("go tool nm: %v\n%s", err, string(out))
@@ -146,7 +151,10 @@ func testGoExec(t *testing.T, iscgo, isexternallinker bool) {
// On AIX, .data and .bss addresses are changed by the loader.
// Therefore, the values returned by the exec aren't the same
// than the ones inside the symbol table.
+ // In case of cgo, .text symbols are also changed.
switch code {
+ case "T", "t", "R", "r":
+ return iscgo
case "D", "d", "B", "b":
return true
}
@@ -267,6 +275,9 @@ func testGoLib(t *testing.T, iscgo bool) {
if runtime.GOOS == "darwin" || (runtime.GOOS == "windows" && runtime.GOARCH == "386") {
syms = append(syms, symType{"D", "_cgodata", true, false})
syms = append(syms, symType{"T", "_cgofunc", true, false})
+ } else if runtime.GOOS == "aix" {
+ syms = append(syms, symType{"D", "cgodata", true, false})
+ syms = append(syms, symType{"T", ".cgofunc", true, false})
} else {
syms = append(syms, symType{"D", "cgodata", true, false})
syms = append(syms, symType{"T", "cgofunc", true, false})