Author: iraisr
Date: Wed May 10 06:43:03 2017
New Revision: 16349
Log:
Fix compilation problems with some unit tests on Ubuntu 16.10+.
Compiler produces position independent executables (PIE) by default
which gets in the way of some unit tests.
Fixes BZ#377066.
Modified:
trunk/NEWS
trunk/configure.ac
trunk/exp-bbv/tests/amd64-linux/Makefile.am
trunk/memcheck/tests/amd64-linux/Makefile.am
trunk/memcheck/tests/amd64/Makefile.am
trunk/none/tests/amd64/Makefile.am
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Wed May 10 06:43:03 2017
@@ -156,6 +156,8 @@
== 371668
376956 syswrap of SNDDRV and DRM_IOCTL_VERSION causing some addresses
to be wrongly marked as addressable
+377066 Some Valgrind unit tests fail to compile on Ubuntu 16.10 with
+ PIE enabled by default
377376 memcheck/tests/linux/getregset fails with glibc2.24
377427 PPC64, lxv instruction failing on odd destination register
377478 PPC64: ISA 3.0 setup fixes
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Wed May 10 06:43:03 2017
@@ -2177,6 +2177,28 @@
AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
+# Does this compiler support -no-pie?
+# On Ubuntu 16.10+, gcc produces position independent executables (PIE) by
+# default. However this gets in the way with some tests, we use -no-pie
+# for these.
+
+AC_MSG_CHECKING([if gcc accepts -no-pie])
+
+safe_CFLAGS=$CFLAGS
+CFLAGS="-no-pie"
+
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
+ return 0;
+]])], [
+AC_SUBST([FLAG_NO_PIE], ["-no-pie"])
+AC_MSG_RESULT([yes])
+], [
+AC_SUBST([FLAG_NO_PIE], [""])
+AC_MSG_RESULT([no])
+])
+CFLAGS=$safe_CFLAGS
+
+
# We want to use use the -Ttext-segment option to the linker.
# GNU (bfd) ld supports this directly. Newer GNU gold linkers
# support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
Modified: trunk/exp-bbv/tests/amd64-linux/Makefile.am
==============================================================================
--- trunk/exp-bbv/tests/amd64-linux/Makefile.am (original)
+++ trunk/exp-bbv/tests/amd64-linux/Makefile.am Wed May 10 06:43:03 2017
@@ -40,3 +40,10 @@
check_PROGRAMS += ll
ll_SOURCES = ll.S
endif
+
+clone_test_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
+complex_rep_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
+fldcw_check_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
+ll_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
+million_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
+rep_prefix_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
Modified: trunk/memcheck/tests/amd64-linux/Makefile.am
==============================================================================
--- trunk/memcheck/tests/amd64-linux/Makefile.am (original)
+++ trunk/memcheck/tests/amd64-linux/Makefile.am Wed May 10 06:43:03 2017
@@ -23,4 +23,4 @@
AM_CCASFLAGS += @FLAG_M64@
defcfaexpr_SOURCES = defcfaexpr.S
-
+defcfaexpr_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
Modified: trunk/memcheck/tests/amd64/Makefile.am
==============================================================================
--- trunk/memcheck/tests/amd64/Makefile.am (original)
+++ trunk/memcheck/tests/amd64/Makefile.am Wed May 10 06:43:03 2017
@@ -63,6 +63,7 @@
AM_CXXFLAGS += @FLAG_M64@
AM_CCASFLAGS += @FLAG_M64@
+fxsave_amd64_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
insn_pcmpistri_CFLAGS = $(AM_CFLAGS)
if VGCONF_OS_IS_SOLARIS
insn_pcmpistri_CFLAGS += --std=c99
@@ -70,4 +71,4 @@
more_x87_fp_CFLAGS = $(AM_CFLAGS) -O -ffast-math -mfpmath=387 \
-mfancy-math-387
more_x87_fp_LDADD = -lm
-
+shr_edx_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
Modified: trunk/none/tests/amd64/Makefile.am
==============================================================================
--- trunk/none/tests/amd64/Makefile.am (original)
+++ trunk/none/tests/amd64/Makefile.am Wed May 10 06:43:03 2017
@@ -172,7 +172,9 @@
# generic C ones
amd64locked_CFLAGS = $(AM_CFLAGS) -O
bug132918_LDADD = -lm
-fxtract_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_OVERFLOW@
+cmpxchg_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
+fcmovnu_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
+fxtract_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_OVERFLOW@ @FLAG_NO_PIE@
insn_basic_SOURCES = insn_basic.def
insn_basic_LDADD = -lm
insn_mmx_SOURCES = insn_mmx.def
@@ -194,6 +196,10 @@
fma4_CFLAGS += -D__EXTENSIONS__
endif
fma4_LDADD = -lm
+jrcxz_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
+looper_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
+sbbmisc_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
+shrld_CFLAGS = $(AM_CFLAGS) @FLAG_NO_PIE@
.def.c: $(srcdir)/gen_insn_test.pl
$(PERL) $(srcdir)/gen_insn_test.pl < $< > $@
|