From patchwork Fri Dec 13 14:04:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Hainque X-Patchwork-Id: 1209154 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515885-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="F3V3RF8j"; 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 47ZC8m3NDJz9sPc for ; Sat, 14 Dec 2019 01:04:38 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:subject:date:message-id:cc:to:mime-version; q=dns; s=default; b=iyzXkuuGfxJP+XGJblAf4ey4BjcTCVMF/3PZsxARSe6+tFe4sc pBcnDqaSswh2uoSwgqP06r3UB5mZxo+BDOLsWjoeUw8hrS5EyOSeXIO1geotcFXO egq1wTo7G6b89ZtZZnU2QU7KqDrYi6+dAwv2klbGoDlHlo/rVn/8G7NsQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:subject:date:message-id:cc:to:mime-version; s= default; bh=zK4ouwAfNz7Zz9/DE4iWi2PNEjc=; b=F3V3RF8jTEkcyJhIvYeg VPJfAeoMN+BrVC6zNc5PWULCUgvaNVmJ3F6LyelKT5T+mnPxJzjDgV0erl/l6Cr+ TsGivbit3qBED7ULIoKhQWkMUjI17KTAglyed9tev4Mjf2/Kz5KEKhj8UzU18g8R u5kvdu12eWYt66Cdb5QhqQw= Received: (qmail 11266 invoked by alias); 13 Dec 2019 14:04:30 -0000 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 Received: (qmail 11255 invoked by uid 89); 13 Dec 2019 14:04:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=dated, COMPILER X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Dec 2019 14:04:28 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id E773681A10; Fri, 13 Dec 2019 15:04:25 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KwBawSIdqWsj; Fri, 13 Dec 2019 15:04:25 +0100 (CET) Received: from [192.168.0.12] (bny92-4-82-228-126-192.fbx.proxad.net [82.228.126.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 95C9981393; Fri, 13 Dec 2019 15:04:25 +0100 (CET) From: Olivier Hainque Subject: [patch] Improve recursion protection for VxWorks limits.h Date: Fri, 13 Dec 2019 15:04:24 +0100 Message-Id: <84161D9C-EE60-49DC-B357-7BB22547B16A@adacore.com> Cc: Olivier Hainque , =?utf-8?b?SsOpcsO0bWUgTGFtYm91?= =?utf-8?q?rg?= To: GCC Patches Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) This change fixes latent failures actually observed when activating libstdc++ for VxWorks on aarch46 VxWorks 7 and powerpc VxWorks 6. The system limits.h is dated on some configurations, so we provide our own version to expose constants required by more recent C standards. Our version includes the system one nevertheless, which has its own specificities. As the system version sometimes originates from GCC, we need to be careful that the two files use distinct macro names to protect against recursive inclusions. We achieve this by setting up an alternate header where we update the inclusion protection macro name: Tested in accordance with the description in https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00911.html Committing to mainline. 2019-12-13 Olivier Hainque Jerome Lambourg * config/t-vxworks: Arrange to alter/restore glimits.h before/after stmp-int-hdrs, so it uses a different macro name to protect itself against recursive inclusions. gcc/config/t-vxworks | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/gcc/config/t-vxworks b/gcc/config/t-vxworks index d3a350f5f8a..86b26cc1ecc 100644 --- a/gcc/config/t-vxworks +++ b/gcc/config/t-vxworks @@ -16,9 +16,40 @@ # along with GCC; see the file COPYING3. If not see # . -# Both the kernel and RTP headers provide limits.h. -LIMITS_H_TEST = true - vxworks.o: $(srcdir)/config/vxworks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TARGET_H) output.h $(TM_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< + +# Both the kernel and RTP headers provide limits.h. They embed VxWorks +# specificities and are dated on some configurations so we both need to +# provide our own version and make sure the system one gets exposed. + +LIMITS_H_TEST = true +STMP_FIXINC = stmp-fixinc + +# VxWorks system environments have been GCC based for a long time and we need +# to make sure that our files and the system ones use distinct macro names to +# protect against recursive inclusions. We achieve this by temporarily +# substituting the headers used by stmp-int-headers with alternative versions +# where we add some version indication in the inclusion-protection macro +# names. + +# Before the standard stmp-int-headers operations take place, arrange to +# copy the current version of the relevant header files locally, generate +# the alternate version and replace the original version with ours: + +stmp-int-hdrs: subst-glimits.h + +subst-%.h: + cp -p $(srcdir)/$*.h orig-$*.h + ID=$$(echo $(BASEVER_c) | sed -e 's/\./_/g'); \ + sed -e "s/_LIMITS_H__/_LIMITS_H_$${ID}_/" < $(srcdir)/$*.h > $@ + cp $@ $(srcdir)/$*.h + +# Then arrange to restore the original versions after the standard +# operations have taken place: + +INSTALL_HEADERS += restore-glimits.h + +restore-glimits.h: stmp-int-hdrs + cp -p orig-glimits.h $(srcdir)/glimits.h