From patchwork Thu Jun 30 16:57:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 642708 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rgQhb08j5z9s9n for ; Fri, 1 Jul 2016 02:57:50 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=OAs7vPvv; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :mime-version:content-type; q=dns; s=default; b=UjBjthEOLAfcvUNY mayqGx2GpF8mQEQ/+ps3yUM+dNLf9dmnjpiDQSXb3sH6+DLUZXc5Moo0vWeKcbxZ SsdcPVoM/v67S7c627GTzphgFuSGvnaUxv0iTNqf4ngt2zYmHoGKkKrx/GDvd6MC 3ZraYUxgzjtaEeoYT2ffWtKNPq0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :mime-version:content-type; s=default; bh=RTlO0Xo9xim5yfbqbQaLmE IhmWI=; b=OAs7vPvvPPMU8CS+icUB/Uen3iJpMxvnVhE/T2i5MBdpmxDHqqUI/j 01GqHpFKOcVs6+iXVEZHbleSijCK5YtExjedUDFl7vMcKK+wMW3f/1+FU9EZ25Nv VkwEg/h2sHphbtkMCcU2PQ5ILC15GfhADAcRnLRvjt8dmVDNri/30= Received: (qmail 32035 invoked by alias); 30 Jun 2016 16:57:43 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 31997 invoked by uid 89); 30 Jun 2016 16:57:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.0 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=genlibcabis, gnu11, sk:config, filterout X-HELO: mga01.intel.com X-ExtLoop1: 1 Date: Thu, 30 Jun 2016 09:57:39 -0700 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] [BZ #20314] Make copies of cstdlib/cmath and use them Message-ID: <20160630165739.GA2465@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.6.1 (2016-04-27) If C++ headers or are used, GCC 6 will include /usr/include/stdlib.h or /usr/include/math.h from "#include_next" (instead of stdlib/stdlib.h or math/math.h in the glibc source directory), and this turns up as a make dependency. An implicit rule will kick in and make will try to install stdlib/stdlib.h or math/math.h as /usr/include/stdlib.h or /usr/include/math.h because the target is out of date. We make a copy of and in the glibc build directory so that stdlib/stdlib.h and math/math.h will be used instead of /usr/include/stdlib.h and /usr/include/math.h. OK for master? H.J. --- [BZ #20314] * Makeconfig (CXXFLAGS): Prepend -I$(common-objpfx). * Makerules (before-compile): Add $(common-objpfx)cstdlib and $(common-objpfx)cmath. ($(common-objpfx)cstdlib): New target. ($(common-objpfx)cmath): Likewise. --- Makeconfig | 3 ++- Makerules | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Makeconfig b/Makeconfig index 901e253..03fd89c 100644 --- a/Makeconfig +++ b/Makeconfig @@ -889,7 +889,8 @@ override CFLAGS = -std=gnu11 -fgnu89-inline $(config-extra-cflags) \ $(CFLAGS-$(@F)) $(tls-model) \ $(foreach lib,$(libof-$(basename $(@F))) \ $(libof-$( or are used, GCC 6 will include +# /usr/include/stdlib.h or /usr/include/math.h from "#include_next" +# (instead of stdlib/stdlib.h or math/math.h in the glibc source +# directory), and this turns up as a make dependency. An implicit +# rule will kick in and make will try to install stdlib/stdlib.h or +# math/math.h as /usr/include/stdlib.h or /usr/include/math.h because +# the target is out of date. We make a copy of and +# in the glibc build directory so that stdlib/stdlib.h and math/math.h +# will be used instead of /usr/include/stdlib.h and /usr/include/math.h. +before-compile := $(common-objpfx)cstdlib $(before-compile) +cstdlib=$(shell echo "\#include " | $(CXX) -M -MP -x c++ - \ + | grep cstdlib: | sed -e "s/:$$//") +$(common-objpfx)cstdlib: $(cstdlib) + $(INSTALL_DATA) $< $@T + $(move-if-change) $@T $@ +before-compile := $(common-objpfx)cmath $(before-compile) +cmath=$(shell echo "\#include " | $(CXX) -M -MP -x c++ - \ + | grep cmath: | sed -e "s/:$$//") +$(common-objpfx)cmath: $(cmath) + $(INSTALL_DATA) $< $@T + $(move-if-change) $@T $@ +endif + before-compile := $(common-objpfx)libc-abis.h $(before-compile) $(common-objpfx)libc-abis.h: $(common-objpfx)libc-abis.stamp; @: $(common-objpfx)libc-abis.stamp: $(..)scripts/gen-libc-abis \