configure.ac: Check for XCOFF32/XCOFF64.

* configure.ac: Check for XCOFF32/XCOFF64.  Check for loadquery.
	* filetype.awk: Separate AIX XCOFF32 and XCOFF64.
	* xcoff.c: Add support for AIX XCOFF32 and XCOFF64 formats.
	* configure, config.h.in: Regenerate.

From-SVN: r250590
This commit is contained in:
Tony Reix 2017-07-26 21:43:28 +00:00 committed by Ian Lance Taylor
parent 993323a14f
commit 7e2a8417f7
7 changed files with 1546 additions and 35 deletions

View file

@ -1,3 +1,10 @@
2017-07-26 Tony Reix <tony.reix@atos.net>
* configure.ac: Check for XCOFF32/XCOFF64. Check for loadquery.
* filetype.awk: Separate AIX XCOFF32 and XCOFF64.
* xcoff.c: Add support for AIX XCOFF32 and XCOFF64 formats.
* configure, config.h.in: Regenerate.
2017-07-21 Tony Reix <tony.reix@atos.net>
* filetype.awk: Add AIX XCOFF type detection.

View file

@ -3,6 +3,9 @@
/* ELF size: 32 or 64 */
#undef BACKTRACE_ELF_SIZE
/* XCOFF size: 32 or 64 */
#undef BACKTRACE_XCOFF_SIZE
/* Define to 1 if you have the __atomic functions */
#undef HAVE_ATOMIC_FUNCTIONS
@ -31,6 +34,9 @@
/* Define to 1 if you have the <link.h> header file. */
#undef HAVE_LINK_H
/* Define if AIX loadquery is available. */
#undef HAVE_LOADQUERY
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@ -49,6 +55,9 @@
/* Define to 1 if you have the __sync functions */
#undef HAVE_SYNC_FUNCTIONS
/* Define to 1 if you have the <sys/ldr.h> header file. */
#undef HAVE_SYS_LDR_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H

View file

@ -12048,9 +12048,9 @@ elf*) FORMAT_FILE="elf.lo" ;;
pecoff) FORMAT_FILE="pecoff.lo"
backtrace_supports_data=no
;;
xcoff) FORMAT_FILE="xcoff.lo"
backtrace_supports_data=no
;;
xcoff*) FORMAT_FILE="xcoff.lo"
backtrace_supports_data=no
;;
*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not determine output file type" >&5
$as_echo "$as_me: WARNING: could not determine output file type" >&2;}
FORMAT_FILE="unknown.lo"
@ -12072,6 +12072,19 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
# XCOFF defines.
xcoffsize=
case "$libbacktrace_cv_sys_filetype" in
xcoff32) xcoffsize=32 ;;
xcoff64) xcoffsize=64 ;;
*) xcoffsize=unused
esac
cat >>confdefs.h <<_ACEOF
#define BACKTRACE_XCOFF_SIZE $xcoffsize
_ACEOF
BACKTRACE_SUPPORTED=0
if test "$backtrace_supported" = "yes"; then
BACKTRACE_SUPPORTED=1
@ -12610,6 +12623,53 @@ $as_echo "#define HAVE_DL_ITERATE_PHDR 1" >>confdefs.h
fi
# Check for loadquery.
for ac_header in sys/ldr.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "sys/ldr.h" "ac_cv_header_sys_ldr_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_ldr_h" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SYS_LDR_H 1
_ACEOF
fi
done
if test "$ac_cv_header_sys_ldr_h" = "no"; then
have_loadquery=no
else
if test -n "${with_target_subdir}"; then
# When built as a GCC target library, we can't do a link test.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/ldr.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "loadquery" >/dev/null 2>&1; then :
have_loadquery=yes
else
have_loadquery=no
fi
rm -f conftest*
else
ac_fn_c_check_func "$LINENO" "loadquery" "ac_cv_func_loadquery"
if test "x$ac_cv_func_loadquery" = x""yes; then :
have_loadquery=yes
else
have_loadquery=no
fi
fi
fi
if test "$have_loadquery" = "yes"; then
$as_echo "#define HAVE_LOADQUERY 1" >>confdefs.h
fi
# Check for the fcntl function.
if test -n "${with_target_subdir}"; then
case "${host}" in

View file

@ -233,9 +233,9 @@ elf*) FORMAT_FILE="elf.lo" ;;
pecoff) FORMAT_FILE="pecoff.lo"
backtrace_supports_data=no
;;
xcoff) FORMAT_FILE="xcoff.lo"
backtrace_supports_data=no
;;
xcoff*) FORMAT_FILE="xcoff.lo"
backtrace_supports_data=no
;;
*) AC_MSG_WARN([could not determine output file type])
FORMAT_FILE="unknown.lo"
backtrace_supported=no
@ -252,6 +252,15 @@ elf64) elfsize=64 ;;
esac
AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64])
# XCOFF defines.
xcoffsize=
case "$libbacktrace_cv_sys_filetype" in
xcoff32) xcoffsize=32 ;;
xcoff64) xcoffsize=64 ;;
*) xcoffsize=unused
esac
AC_DEFINE_UNQUOTED([BACKTRACE_XCOFF_SIZE], [$xcoffsize], [XCOFF size: 32 or 64])
BACKTRACE_SUPPORTED=0
if test "$backtrace_supported" = "yes"; then
BACKTRACE_SUPPORTED=1
@ -330,6 +339,24 @@ if test "$have_dl_iterate_phdr" = "yes"; then
AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.])
fi
# Check for loadquery.
AC_CHECK_HEADERS(sys/ldr.h)
if test "$ac_cv_header_sys_ldr_h" = "no"; then
have_loadquery=no
else
if test -n "${with_target_subdir}"; then
# When built as a GCC target library, we can't do a link test.
AC_EGREP_HEADER([loadquery], [sys/ldr.h], [have_loadquery=yes],
[have_loadquery=no])
else
AC_CHECK_FUNC([loadquery], [have_loadquery=yes],
[have_loadquery=no])
fi
fi
if test "$have_loadquery" = "yes"; then
AC_DEFINE(HAVE_LOADQUERY, 1, [Define if AIX loadquery is available.])
fi
# Check for the fcntl function.
if test -n "${with_target_subdir}"; then
case "${host}" in

View file

@ -70,7 +70,7 @@ dl_iterate_phdr (int (*callback) (struct dl_phdr_info *,
ELF. We could make this code test and support either possibility,
but there is no point. This code only works for the currently
running executable, which means that we know the ELF mode at
configure mode. */
configure time. */
#if BACKTRACE_ELF_SIZE != 32 && BACKTRACE_ELF_SIZE != 64
#error "Unknown BACKTRACE_ELF_SIZE"

View file

@ -3,6 +3,6 @@
/\177ELF\002/ { if (NR == 1) { print "elf64"; exit } }
/\114\001/ { if (NR == 1) { print "pecoff"; exit } }
/\144\206/ { if (NR == 1) { print "pecoff"; exit } }
/\001\337/ { if (NR == 1) { print "xcoff"; exit } }
/\001\367/ { if (NR == 1) { print "xcoff"; exit } }
/\001\337/ { if (NR == 1) { print "xcoff32"; exit } }
/\001\367/ { if (NR == 1) { print "xcoff64"; exit } }

File diff suppressed because it is too large Load diff