From 8bc9c89276b610c8688f2b350178e1fc4900fb74 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 16 Oct 2007 15:15:50 +0000 Subject: [PATCH] PR 5146 * configure.in (AC_CHECK_HEADERS): Add alloca.h * configure: Regenerate. * config.in: Regenerate. * som.c: Replace alloca-conf.h inclusion with code recommended in autoconf documentation. * elf64-hppa.c: Likewise. --- bfd/ChangeLog | 10 ++++++++++ bfd/config.in | 3 +++ bfd/configure | 15 ++++++--------- bfd/configure.in | 2 +- bfd/elf64-hppa.c | 26 +++++++++++++++++++++++++- bfd/som.c | 25 ++++++++++++++++++++++++- 6 files changed, 69 insertions(+), 12 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 09d3a7eaa14..955877df951 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2007-10-16 Nick Clifton + + PR 5146 + * configure.in (AC_CHECK_HEADERS): Add alloca.h + * configure: Regenerate. + * config.in: Regenerate. + * som.c: Replace alloca-conf.h inclusion with code recommended in + autoconf documentation. + * elf64-hppa.c: Likewise. + 2007-10-16 Nick Clifton * configure.in (--enable-elf-stt-common): New configure diff --git a/bfd/config.in b/bfd/config.in index fd14f828b86..38648852105 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -4,6 +4,9 @@ language is requested. */ #undef ENABLE_NLS +/* Define to 1 if you have the header file. */ +#undef HAVE_ALLOCA_H + /* Define to 1 if you have the declaration of `basename', and to 0 if you don't. */ #undef HAVE_DECL_BASENAME diff --git a/bfd/configure b/bfd/configure index 806ee7edaa3..c15a1181916 100755 --- a/bfd/configure +++ b/bfd/configure @@ -10531,14 +10531,11 @@ echo "$as_me: error: bad value ${enableval} for ELF STT_COMMON option" >&2;} esac else # We have to choose a default behaviour. For native builds we could -# test whether the loader supports the STT_COMMON type. For cross -# toolchains we default to assuming that they are not supported. -if test "$cross_compiling" != yes; then - want_elf_stt_common=false - else - # XXX FIXME: Add code to test the loader here. +# test whether the loader supports the STT_COMMON type, but that would +# mean that built binaries could not be exported to older systems where +# the loader does not support it. So by default we always choose to +# disable this feature. want_elf_stt_common=false - fi fi; if test $want_elf_stt_common = true; then cat >>confdefs.h <<\_ACEOF @@ -10549,7 +10546,6 @@ fi - # Check whether --with-pkgversion or --without-pkgversion was given. if test "${with_pkgversion+set}" = set; then withval="$with_pkgversion" @@ -12548,7 +12544,8 @@ fi -for ac_header in stddef.h string.h strings.h stdlib.h time.h unistd.h + +for ac_header in alloca.h stddef.h string.h strings.h stdlib.h time.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then diff --git a/bfd/configure.in b/bfd/configure.in index ad8440e24a2..ac83f114988 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -171,7 +171,7 @@ AC_SUBST(BFD_HOSTPTR_T) BFD_CC_FOR_BUILD -AC_CHECK_HEADERS(stddef.h string.h strings.h stdlib.h time.h unistd.h) +AC_CHECK_HEADERS(alloca.h stddef.h string.h strings.h stdlib.h time.h unistd.h) AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h) GCC_HEADER_STDINT(bfd_stdint.h) AC_HEADER_TIME diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 9a4eae2af9b..0eb1787a119 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -19,7 +19,6 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "alloca-conf.h" #include "sysdep.h" #include "bfd.h" #include "libbfd.h" @@ -27,6 +26,31 @@ #include "elf/hppa.h" #include "libhppa.h" #include "elf64-hppa.h" + +/* This is the code recommended in the autoconf documentation, almost + verbatim. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +/* Indented so that pre-ansi C compilers will ignore it, rather than + choke on it. Some versions of AIX require this to be the first + thing in the file. */ + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +# if !defined (__STDC__) && !defined (__hpux) +extern char *alloca (); +# else +extern void *alloca (); +# endif /* __STDC__, __hpux */ +# endif /* alloca */ +# endif /* _AIX */ +# endif /* HAVE_ALLOCA_H */ +#endif /* __GNUC__ */ + + #define ARCH_SIZE 64 #define PLT_ENTRY_SIZE 0x10 diff --git a/bfd/som.c b/bfd/som.c index 006af8cae2a..a43271c5b5a 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "alloca-conf.h" #include "sysdep.h" #include "bfd.h" @@ -38,6 +37,30 @@ #include #include +/* This is the code recommended in the autoconf documentation, almost + verbatim. */ + +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +/* Indented so that pre-ansi C compilers will ignore it, rather than + choke on it. Some versions of AIX require this to be the first + thing in the file. */ + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +# if !defined (__STDC__) && !defined (__hpux) +extern char *alloca (); +# else +extern void *alloca (); +# endif /* __STDC__, __hpux */ +# endif /* alloca */ +# endif /* _AIX */ +# endif /* HAVE_ALLOCA_H */ +#endif /* __GNUC__ */ + static bfd_reloc_status_type hppa_som_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_boolean som_mkobject (bfd *); -- 2.30.2