]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix compilation problems with some unit tests on Ubuntu 16.10+.
authorIvo Raisr <ivosh@ivosh.net>
Wed, 10 May 2017 05:43:03 +0000 (05:43 +0000)
committerIvo Raisr <ivosh@ivosh.net>
Wed, 10 May 2017 05:43:03 +0000 (05:43 +0000)
Compiler produces position independent executables (PIE) by default
which gets in the way of some unit tests.
Fixes BZ#377066.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16349

NEWS
configure.ac
exp-bbv/tests/amd64-linux/Makefile.am
memcheck/tests/amd64-linux/Makefile.am
memcheck/tests/amd64/Makefile.am
none/tests/amd64/Makefile.am

diff --git a/NEWS b/NEWS
index d65c4d0e21e9a20f6b6ec3280f91501c1385d0ae..869909c6e01e7973a8ca0c9aadd402495471455f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -156,6 +156,8 @@ where XXXXXX is the bug number as listed below.
         == 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
index 51e3121323bcb2c6636ddedafac7e9acaa6f0b91..810a769901ef194a02f782efb7db8bec326a3e6c 100644 (file)
@@ -2177,6 +2177,28 @@ AC_MSG_RESULT([no])
 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
index 7ff89669043f1b2a700ea31304538973c527651d..67bcc02beb0b24c127798e751b693e0d2d31b95b 100644 (file)
@@ -40,3 +40,10 @@ AM_CCASFLAGS   += -Xassembler -I$(top_srcdir)/exp-bbv/tests
 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@
index 56a390be7817ff72d322299b8c9f396a449971c0..94f5d0f1432e0b5266b5ab37e27250f785c9443a 100644 (file)
@@ -23,4 +23,4 @@ AM_CXXFLAGS  += @FLAG_M64@
 AM_CCASFLAGS += @FLAG_M64@
 
 defcfaexpr_SOURCES     = defcfaexpr.S
-
+defcfaexpr_CFLAGS      = $(AM_CFLAGS) @FLAG_NO_PIE@ 
index ef085d0bd7ae6ab8441fbabdb9746e8333332cc0..2b28dcee42882899163be341d3ec3dea296866ca 100644 (file)
@@ -63,6 +63,7 @@ AM_CFLAGS    += @FLAG_M64@
 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 @@ endif
 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@
index f0cd081d7a6bda09fd29e95086c617607e326fc9..11da02a0681aadb87f9d3cb1b0974b80eaadf1f1 100644 (file)
@@ -172,7 +172,9 @@ allexec_CFLAGS              = $(AM_CFLAGS) @FLAG_W_NO_NONNULL@
 # 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 @@ if VGCONF_OS_IS_SOLARIS
 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 < $< > $@