commit-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[2564] 2009-09-03 Magnus Granberg <address@hidden>


From: Robert Millan
Subject: [2564] 2009-09-03 Magnus Granberg <address@hidden>
Date: Thu, 03 Sep 2009 16:32:14 +0000

Revision: 2564
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2564
Author:   robertmh
Date:     2009-09-03 16:32:14 +0000 (Thu, 03 Sep 2009)
Log Message:
-----------
2009-09-03  Magnus Granberg  <address@hidden>

        * aclocal.m4: Add grub_CHECK_PIE. It check if the compiler
        include -fPIE in the default specs.
        * configure.ac: Check if pie_possible is yes and add -fno-PIE
        to TARGET_CFLAGS.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/aclocal.m4
    trunk/grub2/configure.ac

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog       2009-09-03 14:12:27 UTC (rev 2563)
+++ trunk/grub2/ChangeLog       2009-09-03 16:32:14 UTC (rev 2564)
@@ -1,3 +1,10 @@
+2009-09-03  Magnus Granberg  <address@hidden>
+
+       * aclocal.m4: Add grub_CHECK_PIE. It check if the compiler
+       include -fPIE in the default specs.
+       * configure.ac: Check if pie_possible is yes and add -fno-PIE
+       to TARGET_CFLAGS.
+
 2009-09-03  Felix Zielcke  <address@hidden>
 
        * INSTALL: Note that GNU Bison 2.3 or later is required.

Modified: trunk/grub2/aclocal.m4
===================================================================
--- trunk/grub2/aclocal.m4      2009-09-03 14:12:27 UTC (rev 2563)
+++ trunk/grub2/aclocal.m4      2009-09-03 16:32:14 UTC (rev 2564)
@@ -413,3 +413,31 @@
 [fi
 rm -rf testdir]
 ])
+
+dnl Check if the C compiler supports `-fPIE'.
+AC_DEFUN(grub_CHECK_PIE,[
+[# Position independent executable.
+pie_possible=yes]
+AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default])
+# Is this a reliable test case?
+AC_LANG_CONFTEST([[
+#ifdef __PIE__
+int main() {
+       return 0;
+}
+#else
+#error NO __PIE__ DEFINED
+#endif
+]])
+
+[# `$CC -c -o ...' might not be portable.  But, oh, well...  Is calling
+# `ac_compile' like this correct, after all?
+if eval "$ac_compile -S -o conftest.s" 2> /dev/null; then]
+  AC_MSG_RESULT([yes])
+  [# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
+  rm -f conftest.s
+else
+  pie_possible=no]
+  AC_MSG_RESULT([no])
+[fi]
+])

Modified: trunk/grub2/configure.ac
===================================================================
--- trunk/grub2/configure.ac    2009-09-03 14:12:27 UTC (rev 2563)
+++ trunk/grub2/configure.ac    2009-09-03 16:32:14 UTC (rev 2564)
@@ -346,6 +346,14 @@
 # Need __enable_execute_stack() for nested function trampolines?
 grub_CHECK_ENABLE_EXECUTE_STACK
 
+# Position independent executable.
+grub_CHECK_PIE
+[# Need that, because some distributions ship compilers that include
+# `-fPIE' in the default specs.
+if [ x"$pie_possible" = xyes ]; then
+  TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
+fi]
+
 # Smashing stack protector.
 grub_CHECK_STACK_PROTECTOR
 # Need that, because some distributions ship compilers that include





reply via email to

[Prev in Thread] Current Thread [Next in Thread]