Skip to content

Commit

Permalink
* configure.ac: Check for XCOFF32/XCOFF64. Check for loadquery.
Browse files Browse the repository at this point in the history
	* filetype.awk: Separate AIX XCOFF32 and XCOFF64.
	* xcoff.c: Add support for AIX XCOFF32 and XCOFF64 formats.
	* configure, config.h.in: Regenerate.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250590 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
ian committed Jul 26, 2017
1 parent 522e3c6 commit 0a83c23
Show file tree
Hide file tree
Showing 7 changed files with 1,544 additions and 33 deletions.
7 changes: 7 additions & 0 deletions libbacktrace/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2017-07-26 Tony Reix <[email protected]>

* 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 <[email protected]>

* filetype.awk: Add AIX XCOFF type detection.
Expand Down
9 changes: 9 additions & 0 deletions libbacktrace/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
66 changes: 63 additions & 3 deletions libbacktrace/configure
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
33 changes: 30 additions & 3 deletions libbacktrace/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libbacktrace/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions libbacktrace/filetype.awk
Original file line number Diff line number Diff line change
Expand Up @@ -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 } }

Loading

0 comments on commit 0a83c23

Please sign in to comment.