aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/vdso_linux.go
diff options
context:
space:
mode:
authorCarlos Eduardo Seo <cseo@linux.vnet.ibm.com>2018-08-23 20:16:19 -0300
committerLynn Boger <laboger@linux.vnet.ibm.com>2018-08-31 13:12:31 +0000
commitdbd8af74723d2c98cbdcc70f7e2801f69b57ac5b (patch)
treecbd54a861f3f00ca36761be6043ec60a2ec47adf /src/runtime/vdso_linux.go
parent8359b5e134052db0e5f1bc2257d496b0a81aa4fb (diff)
downloadgo-dbd8af74723d2c98cbdcc70f7e2801f69b57ac5b.tar.gz
go-dbd8af74723d2c98cbdcc70f7e2801f69b57ac5b.zip
runtime: add support for VDSO on ppc64x for use in walltime/nanotime
This change adds support for VDSO on ppc64x, making it possible to avoid a syscall in walltime and nanotime. BenchmarkClockVDSOAndFallbackPaths/vDSO-192 20000000 66.0 ns/op BenchmarkClockVDSOAndFallbackPaths/Fallback-192 1000000 1456 ns/op Change-Id: I3373bd804b6f122961de3ae9d034e6ccf35748e6 Reviewed-on: https://go-review.googlesource.com/131135 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Diffstat (limited to 'src/runtime/vdso_linux.go')
-rw-r--r--src/runtime/vdso_linux.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/runtime/vdso_linux.go b/src/runtime/vdso_linux.go
index f6a285efd7..9827874bea 100644
--- a/src/runtime/vdso_linux.go
+++ b/src/runtime/vdso_linux.go
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build linux
-// +build 386 amd64 arm arm64
+// +build 386 amd64 arm arm64 ppc64 ppc64le
package runtime
@@ -42,6 +42,8 @@ const (
_STT_FUNC = 2 /* Symbol is a code object */
+ _STT_NOTYPE = 0 /* Symbol type is not specified */
+
_STB_GLOBAL = 1 /* Global symbol */
_STB_WEAK = 2 /* Weak symbol */
@@ -212,7 +214,8 @@ func vdsoParseSymbols(info *vdsoInfo, version int32) {
sym := &info.symtab[symIndex]
typ := _ELF_ST_TYPE(sym.st_info)
bind := _ELF_ST_BIND(sym.st_info)
- if typ != _STT_FUNC || bind != _STB_GLOBAL && bind != _STB_WEAK || sym.st_shndx == _SHN_UNDEF {
+ // On ppc64x, VDSO functions are of type _STT_NOTYPE.
+ if typ != _STT_FUNC && typ != _STT_NOTYPE || bind != _STB_GLOBAL && bind != _STB_WEAK || sym.st_shndx == _SHN_UNDEF {
return false
}
if k.name != gostringnocopy(&info.symstrings[sym.st_name]) {