From cba8a572c208078c1c6eb9845b54f960526c53c0 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 27 Feb 2019 22:35:10 +0000 Subject: re PR go/89172 (FAIL: runtime/pprof) PR go/89172 internal/cpu, runtime, runtime/pprof: handle function descriptors When using PPC64 ELF ABI v1 a function address is not a PC, but is the address of a function descriptor. The first field in the function descriptor is the actual PC (see http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#FUNC-DES). The libbacktrace library knows about this, and libgo uses actual PC values consistently except for the helper function funcPC that appears in both runtime and runtime/pprof. This patch fixes funcPC by recording, in the internal/cpu package, whether function descriptors are being used. We have to check for function descriptors using a C compiler check, because GCC can be configured using --with-abi to select the ELF ABI to use. Fixes https://gcc.gnu.org/PR89172 Reviewed-on: https://go-review.googlesource.com/c/162978 From-SVN: r269266 --- libgo/configure | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'libgo/configure') diff --git a/libgo/configure b/libgo/configure index 0b8ebce..06b68b0 100755 --- a/libgo/configure +++ b/libgo/configure @@ -661,6 +661,7 @@ GO_SYSCALL_OS_ARCH_FILE GO_SYSCALL_OS_FILE GO_LIBCALL_OS_ARCH_FILE GO_LIBCALL_OS_FILE +FUNCTION_DESCRIPTORS ALLGOARCHFAMILY ALLGOARCH GOARCH @@ -11343,7 +11344,7 @@ else 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 @@ -11449,7 +11450,7 @@ else 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 @@ -14088,6 +14089,27 @@ esac +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= -- cgit v1.1