-c9581de3804f94c5a74ce14befce5c57368722b9
+74533ed435a1a77e6f9ec8f6cf5db1695c2568e8
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
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) $@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+FUNCTION_DESCRIPTORS = @FUNCTION_DESCRIPTORS@
GOARCH = @GOARCH@
GOC = @GOC@
GOFLAGS = @GOFLAGS@
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) $@
GO_SYSCALL_OS_FILE
GO_LIBCALL_OS_ARCH_FILE
GO_LIBCALL_OS_FILE
+FUNCTION_DESCRIPTORS
ALLGOARCHFAMILY
ALLGOARCH
GOARCH
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11346 "configure"
+#line 11347 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11452 "configure"
+#line 11453 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
+FUNCTION_DESCRIPTORS=false
+case ${host} in
+ rs6000*-*-* | powerpc*-*-*)
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#if _CALL_ELF == 1
+#error descriptors
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ FUNCTION_DESCRIPTORS=false
+else
+ FUNCTION_DESCRIPTORS=true
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ;;
+esac
+
+
GO_LIBCALL_OS_FILE=
GO_LIBCALL_OS_ARCH_FILE=
GO_SYSCALL_OS_FILE=
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=
"bytes"
"compress/gzip"
"fmt"
+ internalcpu "internal/cpu"
"io"
"io/ioutil"
"runtime"
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
//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 {
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+FUNCTION_DESCRIPTORS = @FUNCTION_DESCRIPTORS@
GOARCH = @GOARCH@
GOC = @GOC@
GOFLAGS = @GOFLAGS@