===================================================================
@@ -1,4 +1,4 @@
-c9581de3804f94c5a74ce14befce5c57368722b9
+74533ed435a1a77e6f9ec8f6cf5db1695c2568e8
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
===================================================================
@@ -539,6 +539,7 @@ s-cpu: Makefile
rm -f cpugen.go.tmp
echo "package cpu" > cpugen.go.tmp
echo "const CacheLinePadSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> cpugen.go.tmp
+ echo "const FunctionDescriptors = $(FUNCTION_DESCRIPTORS)" >> cpugen.go.tmp
$(SHELL) $(srcdir)/mvifdiff.sh cpugen.go.tmp cpugen.go
$(STAMP) $@
===================================================================
@@ -353,6 +353,20 @@ AC_SUBST(GOARCH)
AC_SUBST(ALLGOARCH)
AC_SUBST(ALLGOARCHFAMILY)
+FUNCTION_DESCRIPTORS=false
+case ${host} in
+ rs6000*-*-* | powerpc*-*-*)
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#if _CALL_ELF == 1
+#error descriptors
+#endif
+])],
+ [FUNCTION_DESCRIPTORS=false],
+ [FUNCTION_DESCRIPTORS=true])
+ ;;
+esac
+AC_SUBST(FUNCTION_DESCRIPTORS)
+
dnl Some files are only present when needed for specific architectures.
GO_LIBCALL_OS_FILE=
GO_LIBCALL_OS_ARCH_FILE=
===================================================================
@@ -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
===================================================================
@@ -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 {