OBS-URL: https://build.opensuse.org/request/show/484837 OBS-URL: https://build.opensuse.org/package/show/Base:System/trustedgrub2?expand=0&rev=7
74 lines
2.5 KiB
Diff
74 lines
2.5 KiB
Diff
commit a3e9da054d00260f274cfd9d1b9611c32ecd437c
|
|
Author: Magnus Granberg <zorry@gentoo.org>
|
|
Date: Wed Dec 14 20:44:41 2016 +0300
|
|
|
|
configure: add check for -no-pie if the compiler default to -fPIE
|
|
|
|
When Grub is compile with gcc 6.1 that have --enable-defult-pie set.
|
|
It fail with.
|
|
-ffreestanding -m32 -Wl,-melf_i386 -Wl,--build-id=none -nostdlib -Wl,-N -Wl,-r,-d -
|
|
o trig.module trig_module-trigtables.o
|
|
grep 'MARKER' gcry_whirlpool.marker.new > gcry_whirlpool.marker; rm -f
|
|
gcry_whirlpool.marker.new
|
|
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: -r and -
|
|
shared may not be used together
|
|
collect2: error: ld returned 1 exit status
|
|
Makefile:26993: recipe for target 'trig.module' failed
|
|
|
|
Check that compiler supports -no-pie and add it to linker flags.
|
|
|
|
Index: trustedgrub2-1.4.0/acinclude.m4
|
|
===================================================================
|
|
--- trustedgrub2-1.4.0.orig/acinclude.m4
|
|
+++ trustedgrub2-1.4.0/acinclude.m4
|
|
@@ -390,6 +390,24 @@ else
|
|
[fi]
|
|
])
|
|
|
|
+dnl Check if the Linker supports `-no-pie'.
|
|
+AC_DEFUN([grub_CHECK_NO_PIE],
|
|
+[AC_MSG_CHECKING([whether linker accepts -no-pie])
|
|
+AC_CACHE_VAL(grub_cv_cc_ld_no_pie,
|
|
+[save_LDFLAGS="$LDFLAGS"
|
|
+LDFLAGS="$LDFLAGS -no-pie"
|
|
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
+ [grub_cv_cc_ld_no_pie=yes],
|
|
+ [grub_cv_cc_ld_no_pie=no])
|
|
+LDFLAGS="$save_LDFLAGS"
|
|
+])
|
|
+AC_MSG_RESULT([$grub_cv_cc_ld_no_pie])
|
|
+nopie_possible=no
|
|
+if test "x$grub_cv_cc_ld_no_pie" = xyes ; then
|
|
+ nopie_possible=yes
|
|
+fi
|
|
+])
|
|
+
|
|
dnl Check if the C compiler supports `-fPIC'.
|
|
AC_DEFUN([grub_CHECK_PIC],[
|
|
[# Position independent executable.
|
|
Index: trustedgrub2-1.4.0/configure.ac
|
|
===================================================================
|
|
--- trustedgrub2-1.4.0.orig/configure.ac
|
|
+++ trustedgrub2-1.4.0/configure.ac
|
|
@@ -1162,13 +1162,18 @@ CFLAGS="$TARGET_CFLAGS"
|
|
|
|
# Position independent executable.
|
|
grub_CHECK_PIE
|
|
+grub_CHECK_NO_PIE
|
|
[# Need that, because some distributions ship compilers that include
|
|
-# `-fPIE' in the default specs.
|
|
+# `-fPIE' or '-fpie' and '-pie' in the default specs.
|
|
if [ x"$pie_possible" = xyes ]; then
|
|
- TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
|
|
+ TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE -fno-pie"
|
|
+fi
|
|
+if [ x"$nopie_possible" = xyes ] && [ x"$pie_possible" = xyes ]; then
|
|
+ TARGET_LDFLAGS="$TARGET_LDFLAGS -no-pie"
|
|
fi]
|
|
|
|
CFLAGS="$TARGET_CFLAGS"
|
|
+LDFLAGS="$TARGET_LDFLAGS"
|
|
|
|
# Position independent executable.
|
|
grub_CHECK_PIC
|