aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go')
-rw-r--r--libgo/go/runtime/pprof/proto.go10
-rw-r--r--libgo/go/runtime/proc.go9
2 files changed, 17 insertions, 2 deletions
diff --git a/libgo/go/runtime/pprof/proto.go b/libgo/go/runtime/pprof/proto.go
index b82e738..27cd09e 100644
--- a/libgo/go/runtime/pprof/proto.go
+++ b/libgo/go/runtime/pprof/proto.go
@@ -8,6 +8,7 @@ import (
"bytes"
"compress/gzip"
"fmt"
+ internalcpu "internal/cpu"
"io"
"io/ioutil"
"runtime"
@@ -28,7 +29,14 @@ func funcPC(f interface{}) uintptr {
data unsafe.Pointer
}
i := (*iface)(unsafe.Pointer(&f))
- return **(**uintptr)(i.data)
+ r := **(**uintptr)(i.data)
+ if internalcpu.FunctionDescriptors {
+ // With PPC64 ELF ABI v1 function descriptors the
+ // function address is a pointer to a struct whose
+ // first field is the actual PC.
+ r = *(*uintptr)(unsafe.Pointer(r))
+ }
+ return r
}
// A profileBuilder writes a profile incrementally from a
diff --git a/libgo/go/runtime/proc.go b/libgo/go/runtime/proc.go
index 1c944d6..0e6c9e1 100644
--- a/libgo/go/runtime/proc.go
+++ b/libgo/go/runtime/proc.go
@@ -446,7 +446,14 @@ func releaseSudog(s *sudog) {
//go:nosplit
func funcPC(f interface{}) uintptr {
i := (*iface)(unsafe.Pointer(&f))
- return **(**uintptr)(i.data)
+ r := **(**uintptr)(i.data)
+ if cpu.FunctionDescriptors {
+ // With PPC64 ELF ABI v1 function descriptors the
+ // function address is a pointer to a struct whose
+ // first field is the actual PC.
+ r = *(*uintptr)(unsafe.Pointer(r))
+ }
+ return r
}
func lockedOSThread() bool {