1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-03 02:36:19 +02:00

Link with `-z relro' when available.

* acinclude.m4 (GUILE_GNU_LD_RELRO): New macro.

* configure.in: Use `GUILE_GNU_LD_RELRO'.
This commit is contained in:
Ludovic Courtès 2009-02-12 23:20:15 +01:00
parent 4f6e6e4fb7
commit 4cc8890001
2 changed files with 24 additions and 1 deletions

View file

@ -1,3 +1,5 @@
dnl -*- Autoconf -*-
dnl On the NeXT, #including <utime.h> doesn't give you a definition for
dnl struct utime, unless you #define _POSIX_SOURCE.
@ -308,3 +310,20 @@ else
fi
AC_LANG_RESTORE
])dnl ACX_PTHREAD
dnl Check whether GNU ld's read-only relocations (the `PT_GNU_RELRO'
dnl ELF segment header) are supported. This allows things like
dnl statically allocated cells (1) to eventually be remapped read-only
dnl by the loader, and (2) to be identified as pointerless by the
dnl garbage collector.
AC_DEFUN([GUILE_GNU_LD_RELRO], [
AC_MSG_CHECKING([whether the linker understands `-z relro'])
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,-z -Wl,relro"
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
LDFLAGS="$save_LDFLAGS"])
])

View file

@ -4,7 +4,7 @@ dnl
define(GUILE_CONFIGURE_COPYRIGHT,[[
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GUILE
@ -1448,6 +1448,10 @@ esac
AC_SUBST(GCC_CFLAGS)
# Check for GNU ld's "-z relro".
GUILE_GNU_LD_RELRO
## If we're creating a shared library (using libtool!), then we'll
## need to generate a list of .lo files corresponding to the .o files
## given in LIBOBJS. We'll call it LIBLOBJS.