Skip to content

Commit 14465a9

Browse files
libbacktrace: declare getpagesize if necessary
Fixes https://gcc.gnu.org/PR95012.
1 parent 7206f5b commit 14465a9

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

config.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
/* Define to 1 if you have the `clock_gettime' function. */
1313
#undef HAVE_CLOCK_GETTIME
1414

15+
/* Define to 1 if you have the declaration of `getpagesize', and to 0 if you
16+
don't. */
17+
#undef HAVE_DECL_GETPAGESIZE
18+
1519
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
1620
don't. */
1721
#undef HAVE_DECL_STRNLEN

configure

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12453,6 +12453,16 @@ fi
1245312453
cat >>confdefs.h <<_ACEOF
1245412454
#define HAVE_DECL_STRNLEN $ac_have_decl
1245512455
_ACEOF
12456+
ac_fn_c_check_decl "$LINENO" "getpagesize" "ac_cv_have_decl_getpagesize" "$ac_includes_default"
12457+
if test "x$ac_cv_have_decl_getpagesize" = xyes; then :
12458+
ac_have_decl=1
12459+
else
12460+
ac_have_decl=0
12461+
fi
12462+
12463+
cat >>confdefs.h <<_ACEOF
12464+
#define HAVE_DECL_GETPAGESIZE $ac_have_decl
12465+
_ACEOF
1245612466
1245712467
for ac_func in lstat readlink
1245812468
do :

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ if test "$have_fcntl" = "yes"; then
383383
[Define to 1 if you have the fcntl function])
384384
fi
385385

386-
AC_CHECK_DECLS(strnlen)
386+
AC_CHECK_DECLS([strnlen, getpagesize])
387387
AC_CHECK_FUNCS(lstat readlink)
388388

389389
# Check for getexecname function.

mmap.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ POSSIBILITY OF SUCH DAMAGE. */
4242
#include "backtrace.h"
4343
#include "internal.h"
4444

45+
#ifndef HAVE_DECL_GETPAGESIZE
46+
extern int getpagesize (void);
47+
#endif
48+
4549
/* Memory allocation on systems that provide anonymous mmap. This
4650
permits the backtrace functions to be invoked from a signal
4751
handler, assuming that mmap is async-signal safe. */

mmapio.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ POSSIBILITY OF SUCH DAMAGE. */
4040
#include "backtrace.h"
4141
#include "internal.h"
4242

43+
#ifndef HAVE_DECL_GETPAGESIZE
44+
extern int getpagesize (void);
45+
#endif
46+
4347
#ifndef MAP_FAILED
4448
#define MAP_FAILED ((void *)-1)
4549
#endif

0 commit comments

Comments
 (0)