From patchwork Tue Jun 14 14:56:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 100353 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id ADC0CB6F92 for ; Wed, 15 Jun 2011 00:56:56 +1000 (EST) Received: (qmail 9224 invoked by alias); 14 Jun 2011 14:56:55 -0000 Received: (qmail 9216 invoked by uid 22791); 14 Jun 2011 14:56:54 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Jun 2011 14:56:40 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 9E3AC845; Tue, 14 Jun 2011 16:56:38 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Wd9mlZbAS67w; Tue, 14 Jun 2011 16:56:36 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 4D320844; Tue, 14 Jun 2011 16:56:36 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id p5EEuZKl015036; Tue, 14 Jun 2011 16:56:35 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Paolo Bonzini , Ralf Wildenhues Subject: [build, libgcc] Correctly apply c_flags in shared-object.mk Date: Tue, 14 Jun 2011 16:56:35 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org When I first did a Solaris 11/x86 bootstrap with gld after checking in my ENABLE_EXECUTE_STACK patch, I found that several acats and gnat.dg tests were failing. This hadn't happened with Sun ld. Reghunting revealed that this had been introduced by that patch. Fortunately, not the code itself was at fault. Instead, before the patch _enable_execute_stack.o had been compiled without -fexceptions, while afterwards (with enable-execute-stack.c added to LIB2ADD) -fexceptions was used. I don't yet understand why this is a problem, and only with gld, but clearly this is not how the LIB2ADD and LIB2ADD_ST objects are supposed to be compiled. In libgcc/Makefile.in, we have # Build LIB2ADD and LIB2ADD_ST. [...] c_flags := iter-items := $(LIB2ADD) $(LIB2ADD_ST) include $(iterator) with iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items)) The problem is that the rule created from shared-object.mk to compile LIB2ADD members refers to $(c_flags), but that variable is evaluated at the point the rule is invoked, not when it is created. Makefile.in sets c_flags 3 times: # Build LIB2ADD and LIB2ADD_ST. [...] c_flags := # Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have [...] c_flags := -fexceptions # Build LIBUNWIND. [...] c_flags := -fexceptions The effect is that not only LIB2ADDEH* and LIBUNWIND sources are compiled with -fexceptions, but everything in LIB2ADD{, _ST}. The following patch fixes this by storing the current value of c_flags in a per-source variable and using that in the generated rules. I've checked that the LIB2ADD members are no longer compiled with -fexceptions. With that patch, all the acats and gnat.dg failures are gone. Bootstrapped without regressions on i386-pc-solaris2.11. Ok for mainline? Rainer 2011-06-12 Rainer Orth * shared-object.mk ($o-opt): Save c_flags. ($(base)$(objext)): Use it. ($(base)_s$(objext)): Likewise. diff --git a/libgcc/shared-object.mk b/libgcc/shared-object.mk --- a/libgcc/shared-object.mk +++ b/libgcc/shared-object.mk @@ -6,13 +6,17 @@ iter-items := $(filter-out $o,$(iter-ite base := $(basename $(notdir $o)) +$o-opt := $(c_flags) + +#$(info $o: c_flags=$(c_flags) o-opt=$($(o)-opt)) + ifeq ($(suffix $o),.c) $(base)$(objext): $o - $(gcc_compile) $(c_flags) -c $< $(vis_hide) + $(gcc_compile) $($<-opt) -c $< $(vis_hide) $(base)_s$(objext): $o - $(gcc_s_compile) $(c_flags) -c $< + $(gcc_s_compile) $($<-opt) -c $< else