Hi Stefan,

On Tue, 8 Nov 2016 21:58:02 +0100 Stefan Potyra <sistp...@ubuntu.com> wrote:
> Hi Balint,
> 
> thanks for the bug report.
> 
> I think this is in fact a problem with PIE: FAUmachine uses a just-in-time
> compiler based on qemu. This is where the error happens:
> 
>   dyngen: unsupported X86_64 relocation (4)
> 
> Maybe the fix is as simple as:
> 
> diff --git a/configure.ac b/configure.ac
> index 980ce16..695ec39 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -447,6 +447,7 @@ AC_PROG_CC_OPTION([-fno-strict-aliasing], 
> [fm_jit_gen_cflags="${fm_jit_gen_cflag
>  AC_PROG_CC_OPTION([-fno-reorder-blocks], 
> [fm_jit_gen_cflags="${fm_jit_gen_cflags} -fno-reorder-blocks"])
>  AC_PROG_CC_OPTION([-fno-ipa-icf], [fm_jit_gen_cflags="${fm_jit_gen_cflags} 
> -fno-ipa-icf"])
>  AC_PROG_CC_OPTION([-fno-gcse], [fm_jit_gen_cflags="${fm_jit_gen_cflags} 
> -fno-gcse"])
> +AC_PROG_CC_OPTION([-fno-gcse], [fm_jit_gen_cflags="${fm_jit_gen_cflags} 
> -no-pie"])
>  AC_SUBST([fm_jit_gen_cflags])
>  
>  # Compiler warnings (not needed but nice to have).
> 
> 
> However I haven't tested this yet. Hopefully, I find some time this weekend, 
> but
> I cannot make any promises :/.

I took a look and -fno-PIE is needed here to make code generation work.

I made some other changes but the build still fails later with:
...
./dyngen -g -p chip_intel_80686_coppermine_op_ -o 
cpu_686_coppermine_jit_gen_op_gen.h 
libqemu_gen_686_coppermine_a-cpu_686_coppermine_jit_op.o
Warning: no return instruction found in 
chip_intel_80686_coppermine_op_raise_interrupt
Warning: no return instruction found in 
chip_intel_80686_coppermine_op_raise_interrupt
Warning: no return instruction found in 
chip_intel_80686_coppermine_op_raise_exception
Warning: no return instruction found in 
chip_intel_80686_coppermine_op_raise_exception
Warning: no return instruction found in 
chip_intel_80686_coppermine_op_raise_interrupt
Warning: no return instruction found in 
chip_intel_80686_coppermine_op_raise_exception
dyngen: Unsupported opcode c2 in chip_intel_80686_coppermine_op_rsqrtps
Makefile:916: recipe for target 'cpu_686_coppermine_jit_opc_gen.h' failed
make[5]: *** [cpu_686_coppermine_jit_opc_gen.h] Error 1
make[5]: *** Waiting for unfinished jobs....
...

Cheers,
Balint
diff -Nru faumachine-20160511/debian/changelog faumachine-20160511/debian/changelog
--- faumachine-20160511/debian/changelog	2016-05-26 18:22:46.000000000 +0200
+++ faumachine-20160511/debian/changelog	2016-12-17 23:40:01.000000000 +0100
@@ -1,3 +1,10 @@
+faumachine (20160511-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTBFS due to PIE being enabled in GCC by default (Closes: 837450)
+
+ -- Balint Reczey <bal...@balintreczey.hu>  Sat, 17 Dec 2016 23:39:18 +0100
+
 faumachine (20160511-1) unstable; urgency=medium
 
   * New upstream release, highlights:
diff -Nru faumachine-20160511/debian/patches/01_disable_pie_in_jit.patch faumachine-20160511/debian/patches/01_disable_pie_in_jit.patch
--- faumachine-20160511/debian/patches/01_disable_pie_in_jit.patch	1970-01-01 01:00:00.000000000 +0100
+++ faumachine-20160511/debian/patches/01_disable_pie_in_jit.patch	2016-12-17 23:53:43.000000000 +0100
@@ -0,0 +1,22 @@
+Description: Disable PIE for JIT
+ PIE is enabled in GCC by default and the JIT does now support that.
+ .
+Author: Stefan Potyra <sistp...@ubuntu.com>
+Bug-Debian: https://bugs.debian.org/837450
+
+Origin: other, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837450#12
+Bug-Debian: https://bugs.debian.org/837450
+Forwarded: no
+Reviewed-By: Balint Reczey <bal...@balintreczey.hu>
+Last-Update: 2016-12-17
+
+--- faumachine-20160511.orig/configure.ac
++++ faumachine-20160511/configure.ac
+@@ -422,6 +422,7 @@ AC_PROG_CC_OPTION([-fno-strict-aliasing]
+ AC_PROG_CC_OPTION([-fno-reorder-blocks], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -fno-reorder-blocks"])
+ AC_PROG_CC_OPTION([-fno-ipa-icf], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -fno-ipa-icf"])
+ AC_PROG_CC_OPTION([-fno-gcse], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -fno-gcse"])
++AC_PROG_CC_OPTION([-fno-gcse], [fm_jit_gen_cflags="${fm_jit_gen_cflags} -fno-PIE"])
+ AC_SUBST([fm_jit_gen_cflags])
+ 
+ # Compiler warnings (not needed but nice to have).
diff -Nru faumachine-20160511/debian/patches/02_enable_passing_cflags.patch faumachine-20160511/debian/patches/02_enable_passing_cflags.patch
--- faumachine-20160511/debian/patches/02_enable_passing_cflags.patch	1970-01-01 01:00:00.000000000 +0100
+++ faumachine-20160511/debian/patches/02_enable_passing_cflags.patch	2016-12-18 00:24:34.000000000 +0100
@@ -0,0 +1,23 @@
+Description: Let configure take CFLAGS
+ Disabling PIE needs adjusting CFLAGS.
+Author: Balint Reczey <bal...@balintreczey.hu>
+Bug-Debian: https://bugs.debian.org/837450
+Forwarded: not-needed
+
+--- faumachine-20160511.orig/configure.ac
++++ faumachine-20160511/configure.ac
+@@ -12,10 +12,10 @@ AC_INIT([FAUmachine],[CURRENT],[info@fau
+ AC_CONFIG_AUX_DIR(scripts)
+ 
+ # reset CFLAGS; user-defined CFLAGS are unsupported
+-if test -n "$CFLAGS" ; then
+-	AC_MSG_WARN([[user-defined CFLAGS are unsupported and will be ignored]])
+-	$as_unset CFLAGS || test "${CFLAGS+set}" != set || { CFLAGS=; export CFLAGS; }
+-fi
++#if test -n "$CFLAGS" ; then
++#	AC_MSG_WARN([[user-defined CFLAGS are unsupported and will be ignored]])
++#	$as_unset CFLAGS || test "${CFLAGS+set}" != set || { CFLAGS=; export CFLAGS; }
++#fi
+ 
+ # find out if we should use -Werror by default
+ AC_MSG_CHECKING([whether this is a cvs build])
diff -Nru faumachine-20160511/debian/patches/series faumachine-20160511/debian/patches/series
--- faumachine-20160511/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ faumachine-20160511/debian/patches/series	2016-12-18 00:23:28.000000000 +0100
@@ -0,0 +1,2 @@
+01_disable_pie_in_jit.patch
+02_enable_passing_cflags.patch
diff -Nru faumachine-20160511/debian/rules faumachine-20160511/debian/rules
--- faumachine-20160511/debian/rules	2016-05-26 18:22:46.000000000 +0200
+++ faumachine-20160511/debian/rules	2016-12-18 00:19:37.000000000 +0100
@@ -21,7 +21,7 @@
 
 config.status: configure
 	dh_testdir
-	./configure \
+	./configure CFLAGS=-fno-PIE LDFLAGS=-no-pie \
 		--prefix=/usr \
 		--mandir=/usr/share/man \
 		--enable-build-userguide \

Reply via email to