From patchwork Fri Dec 13 17:30:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Hainque X-Patchwork-Id: 1209301 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-515913-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="d9RmvmS7"; 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 47ZHlB5cPLz9sPK for ; Sat, 14 Dec 2019 04:31:16 +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=muJZm6Fky4V8k8xXrK2bo1Tlkk6F/f6aXa6D1OmZZNo8f7op+h TyUnj7Og1GLB4jSeXRGSh55nIxw+yrT2sUezJkwEoHW98XrMoG96Co53aRfvM6nd D/akwrvV/6bishaWBXIPQHor7Txxe5jE1rQBTSEIbUIbR1v3WPvs3DbMw= 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=vQUkuwUNMCeMajkg/fsyERmIeCY=; b=d9RmvmS78DCd32slAreC UKq/238Yi7o/mfsPNznVDqKDFB3OtHtqCIMJBwnF5F1jtUF8spNJFKFC/ZOupDK7 jZBPOorQ9MgRen4owsDSvatDFucVm9s8e1YqpRXlltK4gOSvRfERg0GbK21PUGu1 +hhvpaO9DVRRmcrok6IN4M0= Received: (qmail 5874 invoked by alias); 13 Dec 2019 17:31:04 -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 5384 invoked by uid 89); 13 Dec 2019 17:30:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Weak, assumptions 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 17:30:44 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id DD72C813A1; Fri, 13 Dec 2019 18:30:24 +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 UC3CDs-C6uvI; Fri, 13 Dec 2019 18:30:24 +0100 (CET) Received: from [IPv6:2a02:2ab8:224:100::1002] (unknown [IPv6:2a02:2ab8:224:100::1002]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id D54438139C; Fri, 13 Dec 2019 18:30:23 +0100 (CET) From: Olivier Hainque Subject: [patch] Adapt libstdc++ os_defines for VxWorks to more recent versions Date: Fri, 13 Dec 2019 18:30:21 +0100 Message-Id: Cc: Olivier Hainque , =?utf-8?b?SsOpcsO0bWUgTGFtYm91?= =?utf-8?q?rg?= , libstdc++@gcc.gnu.org To: GCC Patches Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Hello, This change reworks the VxWorks specific os_defines.h internal lisbstdc++ header to help fix build and runtime failures of various kinds in environments from 6.4/6.9 to 7 SR640, based on experiments and observations conducted against real installs of these OSes for different CPU architectures. This is touching a vxworks specific header file and libstdc++ is currently not included in standard builds, so I'm planning to commit to mainline in preparation of further changes which will allow relaxing the current exclusion. Best Regards, Olivier 2019-12-13 Jerome Lambourg Olivier Hainque libstdc++ * config/os/vxworks/os_defines.h (NOMINMAX): Always redefine to 1. (_NO_CPP_INLINES): Likewise. (_GLIBCXX_USE_WEAK_REF): Define to 1 for RTP on VxWorks >= 7, to 0 otherwise. (_GLIBCXX_HAVE_TLS): Define to 1. For VxWorks >= 7: (_GLIBCXX_USE_C99_MATH): Define to 1. (_GLIBCXX_USE_C99_MATH_FP_MACROS_DYNAMIC): Define to 0. (_HAS_TR1_DECLARATIONS): Redefine to 0. For VxWorks < 7, RTP: (_GLIBCXX_INCLUDE_NEXT_C_HEADERS): Define to 1. (_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC): Redefine to 1. (__CORRECT_ISO_CPP11_MATH_H_PROTO_FP): Define. For VxWorks < 7, kernel: #include libstdc++-v3/config/os/vxworks/os_defines.h | 67 +++++++++++++++++++-- 1 file changed, 63 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/config/os/vxworks/os_defines.h b/libstdc++-v3/config/os/vxworks/os_defines.h index 3a9a9587622..c5573a40b0d 100644 --- a/libstdc++-v3/config/os/vxworks/os_defines.h +++ b/libstdc++-v3/config/os/vxworks/os_defines.h @@ -33,10 +33,69 @@ // System-specific #define, typedefs, corrections, etc, go here. This // file will come before all others. -//Keep vxWorks from defining min()/max() as macros -#ifdef NOMINMAX -#undef NOMINMAX +// The system environment we can rely on varies across VxWorks +// versions. +#include <_vxworks-versions.h> + +// Weak refs are supported starting with VxWorks 7, in RTP mode only + +#if _VXWORKS_MAJOR_GE(7) && defined(__RTP__) +#define _GLIBCXX_USE_WEAK_REF 1 +#else +#define _GLIBCXX_USE_WEAK_REF 0 #endif + +// We support TLS on VxWorks (either directly or with emutls) +#define _GLIBCXX_HAVE_TLS 1 + +// VxWorks7 comes with a DinkumWare library and the system headers which we +// are going to include for libstdc++ have a few related intrinsic +// assumptions. We control our own configuration here to best integrate with +// this environment: use C99 math headers, do not use the FP macros for +// dynamic cast by default (overriden for RTPs below) and arrange to disable +// the system TR1 declarations as we'll provide ours. + +#if _VXWORKS_MAJOR_GE(7) + +#define _GLIBCXX_USE_C99_MATH 1 +#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC 0 + +#undef _HAS_TR1_DECLARATIONS +#define _HAS_TR1_DECLARATIONS 0 + +#else // VXWORKS_MAJOR < 7 + +// For RTPs, use the VxWorks headers as a basis, from which we can use +// C99 dynamic FP macros and expect (after fixincludes) accurate c++11 +// prototypes for FP. + +#ifdef __RTP__ + +#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS 1 + +#undef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC +#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC 1 + +#define __CORRECT_ISO_CPP11_MATH_H_PROTO_FP + +#else // !__RTP__ + +// libstdc++ will include system headers and vxWorks.h ought to have +// been included ahead for VxWorks kernel modules prior to VxWorks 7 +#include + +#endif // __RTP__ + +#endif // _VXWORKS_MAJOR >= 7 + +// The min/max "functions" may be refered to with a namespace prefix. +// Prevent possible redefinitions as macros from VxWorks headers. +#undef NOMINMAX #define NOMINMAX 1 -#endif +// Do not include the inline definitions from VxWorks headers, as we'll +// want to use the ones from libstdc++ instead. +#undef _NO_CPP_INLINES +#define _NO_CPP_INLINES 1 + +#endif // _GLIBCXX_OS_DEFINES