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

[libvirt] [PATCH 2/2] maint: extend PIE support check



GCC installed from FreeBSD ports doesn't support building PIE executables
and fails with:

/usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against
`_DYNAMIC' can not be used when making a shared object; recompile with
-fPIC
/usr/lib/crt1.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

However, the configure check for '-fPIC -DPIC' doesn't catch that. In
order to catch this case, add '-pie' to CFLAGS in m4/virt-compile-pie.m4
so it could detect lack of PIE support on configure time and don't fail
the build.
---
 m4/virt-compile-pie.m4 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/m4/virt-compile-pie.m4 b/m4/virt-compile-pie.m4
index cceb495..c0fb346 100644
--- a/m4/virt-compile-pie.m4
+++ b/m4/virt-compile-pie.m4
@@ -25,8 +25,8 @@ AC_DEFUN([LIBVIRT_COMPILE_PIE],[
       *-*-mingw* | *-*-msvc* | *-*-cygwin* )
          ;; dnl All code is position independent on Win32 target
       *)
-      gl_COMPILER_OPTION_IF([-fPIE -DPIE], [
-        PIE_CFLAGS="-fPIE -DPIE"
+      gl_COMPILER_OPTION_IF([-fPIE -DPIE -pie], [
+        PIE_CFLAGS="-fPIE -DPIE -pie"
         PIE_LDFLAGS="-pie"
       ])
     esac
-- 
2.3.7


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