From patchwork Thu Feb 8 17:58:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 871013 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-90145-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="TNDT17pZ"; dkim-atps=neutral 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 3zcmCC2Rsgz9s75 for ; Fri, 9 Feb 2018 04:58:31 +1100 (AEDT) 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=w/zHPmTyhaZlYSlc /2nMc1comzo2Ki1nacqpT+xJ+kyempVIxc5z6/XEWU8yGN8tQhkIEYYaa0CWj3V4 bqeNvQJaXJew16GPE0AOdVq/asbLrP+pbfVC38Sw2xIC823xcP7u+Sc8JuyV9J4K un/eFPQs2hUYu8O9s93mU+oWCKM= 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=IaVapUfeH7HF4i51BE1WJF /DrTY=; b=TNDT17pZP4+Tu0swOfQFNPNbfR1lKnNzqxnJohW2FVQPyBtoL3fxvZ yX41vTsnkoQ9cuETmmkWzyjMwlE7CxiFZlAcwMCJNmNCD39qWnOwSChzK0QhQonK yNikuQibRDZpO0JCyXb49GBZPJ+GBexVqtfENtTMMSfxnLcCiX7gQ= Received: (qmail 106952 invoked by alias); 8 Feb 2018 17:58:24 -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 106940 invoked by uid 89); 8 Feb 2018 17:58:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:2713 X-HELO: mga03.intel.com X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False X-ExtLoop1: 1 Date: Thu, 8 Feb 2018 09:58:18 -0800 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] Define GEN_AS_CONST_HEADERS when generating header files [BZ #22792] Message-ID: <20180208175818.GA8519@gmail.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) Glibc build generates header files to define constants from special .sym files. If a .sym file includes the same header file which it generates, it leads to circular dependency. Define GEN_AS_CONST_HEADERS when generating header files to avoid circular dependency. is needed for i686 and it isn't needed for x86-64 at least since glibc 2.23. Tested on i686 and x86-64. OK for trunk? H.J. --- [BZ #22792] * Makerules ($(common-objpfx)%.h): Pass -DGEN_AS_CONST_HEADERS to $(CC). * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Include only if GEN_AS_CONST_HEADERS isn't defined. * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Don't include . --- Makerules | 4 +++- sysdeps/unix/sysv/linux/i386/lowlevellock.h | 4 +++- sysdeps/unix/sysv/linux/x86_64/lowlevellock.h | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makerules b/Makerules index ef6abeac6d..10a2e83468 100644 --- a/Makerules +++ b/Makerules @@ -276,10 +276,12 @@ ifdef gen-as-const-headers # Generating headers for assembly constants. # We need this defined early to get into before-compile before # it's used in sysd-rules, below. +# Define GEN_AS_CONST_HEADERS to avoid circular dependency [BZ #22792]. $(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \ %.sym $(common-before-compile) $(AWK) -f $< $(filter %.sym,$^) \ - | $(CC) -S -o $(@:.h.d=.h)T3 $(CFLAGS) $(CPPFLAGS) -x c - \ + | $(CC) -S -o $(@:.h.d=.h)T3 $(CFLAGS) $(CPPFLAGS) \ + -DGEN_AS_CONST_HEADERS -x c - \ -MD -MP -MF $(@:.h=.h.d)T -MT '$(@:.h=.h.d) $(@:.h.d=.h)' sed -n 's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$$/#define \1 \2/p' \ $(@:.h.d=.h)T3 > $(@:.h.d=.h)T diff --git a/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/sysdeps/unix/sysv/linux/i386/lowlevellock.h index fb59b57934..9f081e8a05 100644 --- a/sysdeps/unix/sysv/linux/i386/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/i386/lowlevellock.h @@ -26,7 +26,9 @@ # include # include # include -# include +# ifndef GEN_AS_CONST_HEADERS +# include +# endif # ifndef LOCK_INSTR # ifdef UP diff --git a/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h index a8bcfbe4a3..eedb6fc990 100644 --- a/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h +++ b/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h @@ -26,7 +26,6 @@ # include # include # include -# include # ifndef LOCK_INSTR # ifdef UP