libbacktrace: declare getpagesize if necessary

libbacktrace/
	PR libbacktrace/95012
	* configure.ac: Check for getpagesize declaration.
	* mmap.c: Declare getpagesize if necessary.
	* mmapio.c: Likewise.
This commit is contained in:
Ian Lance Taylor 2020-05-11 10:51:21 -07:00
parent ed07d68141
commit 47f4703c33
7 changed files with 34 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2020-05-11 Ian Lance Taylor <iant@golang.org>
PR libbacktrace/95012
* configure.ac: Check for getpagesize declaration.
* mmap.c: Declare getpagesize if necessary.
* mmapio.c: Likewise.
* configure: Regenerate.
* config.h.in: Regenerate.
* Makefile.in: Regenerate.
2020-05-09 Roland McGrath <mcgrathr@google.com> 2020-05-09 Roland McGrath <mcgrathr@google.com>
* elf.c (elf_add): Bail early if there are no section headers at all. * elf.c (elf_add): Bail early if there are no section headers at all.

View File

@ -2266,7 +2266,7 @@ uninstall-am:
@HAVE_DSYMUTIL_TRUE@%.dSYM: % @HAVE_DSYMUTIL_TRUE@%.dSYM: %
@HAVE_DSYMUTIL_TRUE@ $(DSYMUTIL) %< @HAVE_DSYMUTIL_TRUE@ $(DSYMUTIL) $<
@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@elf_for_test.c: elf.c @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@elf_for_test.c: elf.c
@HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ SEARCH='^#define SYSTEM_BUILD_ID_DIR.*$$'; \ @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@ SEARCH='^#define SYSTEM_BUILD_ID_DIR.*$$'; \

View File

@ -12,6 +12,10 @@
/* Define to 1 if you have the `clock_gettime' function. */ /* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME #undef HAVE_CLOCK_GETTIME
/* Define to 1 if you have the declaration of `getpagesize', and to 0 if you
don't. */
#undef HAVE_DECL_GETPAGESIZE
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you /* Define to 1 if you have the declaration of `strnlen', and to 0 if you
don't. */ don't. */
#undef HAVE_DECL_STRNLEN #undef HAVE_DECL_STRNLEN

View File

@ -13166,6 +13166,16 @@ fi
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRNLEN $ac_have_decl #define HAVE_DECL_STRNLEN $ac_have_decl
_ACEOF _ACEOF
ac_fn_c_check_decl "$LINENO" "getpagesize" "ac_cv_have_decl_getpagesize" "$ac_includes_default"
if test "x$ac_cv_have_decl_getpagesize" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_GETPAGESIZE $ac_have_decl
_ACEOF
for ac_func in lstat readlink for ac_func in lstat readlink
do : do :

View File

@ -376,7 +376,7 @@ if test "$have_fcntl" = "yes"; then
[Define to 1 if you have the fcntl function]) [Define to 1 if you have the fcntl function])
fi fi
AC_CHECK_DECLS(strnlen) AC_CHECK_DECLS([strnlen, getpagesize])
AC_CHECK_FUNCS(lstat readlink) AC_CHECK_FUNCS(lstat readlink)
# Check for getexecname function. # Check for getexecname function.

View File

@ -42,6 +42,10 @@ POSSIBILITY OF SUCH DAMAGE. */
#include "backtrace.h" #include "backtrace.h"
#include "internal.h" #include "internal.h"
#ifndef HAVE_DECL_GETPAGESIZE
extern int getpagesize (void);
#endif
/* Memory allocation on systems that provide anonymous mmap. This /* Memory allocation on systems that provide anonymous mmap. This
permits the backtrace functions to be invoked from a signal permits the backtrace functions to be invoked from a signal
handler, assuming that mmap is async-signal safe. */ handler, assuming that mmap is async-signal safe. */

View File

@ -40,6 +40,10 @@ POSSIBILITY OF SUCH DAMAGE. */
#include "backtrace.h" #include "backtrace.h"
#include "internal.h" #include "internal.h"
#ifndef HAVE_DECL_GETPAGESIZE
extern int getpagesize (void);
#endif
#ifndef MAP_FAILED #ifndef MAP_FAILED
#define MAP_FAILED ((void *)-1) #define MAP_FAILED ((void *)-1)
#endif #endif