This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix AIX bootstrap comparison due to empty *-tests.c and selftest* files (PR bootstrap/80531)


Hi!

This is something that fails bootstrap newly in GCC 7 and only with
(now on the branch default --enable-checking=release (or
--disable-checking)).  The problem is that the *-tests.c and selftest*.c
sources after including some headers have the whole body guarded with
#if CHECKING_P
and with release checking thus there are no global symbols.
symtab_node::debug_symtab is a static inline method with DEBUG_FUNCTION and thus
is emitted (due to __attribute__((used))) - something we should really fix,
by moving its definition out of cgraph.h.
For some unknown reason AIX cc1plus emits:
        .csect _functiontests.ro_[RO],4
        .align 2
        .globl _GLOBAL__F_.._.._gcc_function_tests.c_DFF67DD7_0x28c82f7f
_GLOBAL__F_.._.._gcc_function_tests.c_DFF67DD7_0x28c82f7f:
Lframe..1:
        .vbyte  4,LECIE..1-LSCIE..1
and thus has the random seed in the symbol table.

The following patch fixes it by making sure we build all the
selftest*/*tests* objects with -frandom-seed=$@ and thus it is consistent.
As a bonus for other targets, the objects are now put together and thus
should be improve code locality for actual compiler code, not tests,
when doing checking builds.

Bootstrapped/regtested on x86_64-linux, i686-linux and (together with
the libgomp patch I've already committed) on powerpc-ibm-aix7.2.0.0,
ok for trunk/7.1?

I'd like to do a RC2 tomorrow.

2017-04-27  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/80531
	* Makefile.in (SELFTEST_OBJS): New variable.
	For $(SELFTEST_OBJS) and selftest.o append -frandom-seed=$@ to
	ALL_COMPILERFLAGS.
	(OBJS): Remove *-tests.o and selftest-*.o, add $(SELFTEST_OBJS).

--- gcc/Makefile.in.jj	2017-04-25 21:44:02.000000000 +0200
+++ gcc/Makefile.in	2017-04-27 18:32:06.661511629 +0200
@@ -1187,6 +1187,11 @@ C_COMMON_OBJS = c-family/c-common.o c-fa
   c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o \
   c-family/c-attribs.o c-family/c-warn.o
 
+# The self-test objects that are empty in release checking builds.
+SELFTEST_OBJS = selftest-rtl.o selftest-run-tests.o \
+  function-tests.o ggc-tests.o hash-map-tests.o hash-set-tests.o \
+  rtl-tests.o
+
 # Language-independent object files.
 # We put the *-match.o and insn-*.o files first so that a parallel make
 # will build them sooner, because they are large and otherwise tend to be
@@ -1279,13 +1284,11 @@ OBJS = \
 	fold-const.o \
 	fold-const-call.o \
 	function.o \
-	function-tests.o \
 	fwprop.o \
 	gcc-rich-location.o \
 	gcse.o \
 	gcse-common.o \
 	ggc-common.o \
-	ggc-tests.o \
 	gimple.o \
 	gimple-builder.o \
 	gimple-expr.o \
@@ -1319,8 +1322,6 @@ OBJS = \
 	graphite-sese-to-poly.o \
 	gtype-desc.o \
 	haifa-sched.o \
-	hash-map-tests.o \
-	hash-set-tests.o \
 	hsa-common.o \
 	hsa-gen.o \
 	hsa-regalloc.o \
@@ -1429,7 +1430,6 @@ OBJS = \
 	resource.o \
 	rtl-chkp.o \
 	rtl-error.o \
-	rtl-tests.o \
 	rtl.o \
 	rtlhash.o \
 	rtlanal.o \
@@ -1443,8 +1443,6 @@ OBJS = \
 	sel-sched-ir.o \
 	sel-sched-dump.o \
 	sel-sched.o \
-	selftest-rtl.o \
-	selftest-run-tests.o \
 	sese.o \
 	shrink-wrap.o \
 	simplify-rtx.o \
@@ -1574,7 +1572,8 @@ OBJS = \
 	xcoffout.o \
 	$(out_object_file) \
 	$(EXTRA_OBJS) \
-	$(host_hook_obj)
+	$(host_hook_obj) \
+	$(SELFTEST_OBJS)
 
 # Objects in libcommon.a, potentially used by all host binaries and with
 # no target dependencies.
@@ -1607,6 +1606,10 @@ $(ALL_HOST_BACKEND_OBJS): ALL_COMPILERFL
 $(ALL_HOST_BACKEND_OBJS): cc1plus.fda
 endif
 
+# The self-test objects are empty in release checking builds, make sure
+# AIX/HPUX don't trigger comparison failures on them.
+$(SELFTEST_OBJS) selftest.o: ALL_COMPILERFLAGS += -frandom-seed=$@
+
 # This lists all host object files, whether they are included in this
 # compilation or not.
 ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS)

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]