From patchwork Fri Dec 13 16:12:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Hainque X-Patchwork-Id: 1209252 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-515905-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="bL30j2zv"; 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 47ZG152jNxz9sPT for ; Sat, 14 Dec 2019 03:13:10 +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=qY2G07EEcE8co1hN8dLSsRdHgbPjuULx566fuuiWlcGZa7Pdz6 N4qCANIPhOUndL0pf6zLHbq1BMlibCJkk48FwIboSZu97diGvdwv3a3R0IVWEJl2 goJYcjSmIosQGYF8yBz7cnQwcslir2SKfgb+TG52JCoORRkT7TpkJgIIw= 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=YXR2yKPG1TduIqYHJm6Ix+dvKnE=; b=bL30j2zvmSIsZQVVKyJ6 t67c0tz+T8enVk5LaApzdl/KEsQAN4pwj0BqvUwaZaoLaJwfW/hZPNSo0nmaT3tf HXdO8Ez6hd02vB0+cRjel6l1ZKzIRxMzudJ2XRHz7FNUOOnpeEdnggFoVCM1sbbm 54K4y9O9nstAqFMi7G+1gPQ= Received: (qmail 118494 invoked by alias); 13 Dec 2019 16:13:02 -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 116063 invoked by uid 89); 13 Dec 2019 16:13:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.6 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=granted, configgcc, config.gcc, cfamily 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 16:12:58 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id D4F5D818D7; Fri, 13 Dec 2019 17:12:55 +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 4QAIjTz15XjV; Fri, 13 Dec 2019 17:12:55 +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 7D8C281390; Fri, 13 Dec 2019 17:12:55 +0100 (CET) From: Olivier Hainque Subject: [patch] Setup TARGET_C_PREINCLUDE for VxWorks Date: Fri, 13 Dec 2019 17:12:54 +0100 Message-Id: <1CD51A8B-E104-470C-B83D-641DDEA53268@adacore.com> Cc: Olivier Hainque , Joel Brobecker To: GCC Patches Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) This patch modifies the C & C++ VxWorks compiler to predefine the __STDC_ macros verified by gcc.dg/c99-predef-1.c in the testsuite. We setup a vxworks-predef.h header file which arranges to define TARGET_C_PREINCLUDE, in a separate config/vxworks directory where other runtime header files will be added afterwards for libstdc++ support. Tested in accordance with the description in https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00911.html Committing to mainline. Olivier 2019-12-13 Joel Brobecker * config.gcc <*-*-vxworks*>: Add vxworks-c.o to c_target_objs and cxx_target_objs. Set target_has_targetcm to "yes". Add vxworks-predef.h to extra_headers. * config/t-vxworks (vxworks-c.o): New target. * config/vxworks-c.c: New file. * config/vxworks/vxworks-predef.h: New file. gcc/config.gcc | 4 ++++ gcc/config/t-vxworks | 4 ++++ gcc/config/vxworks-c.c | 37 +++++++++++++++++++++++++++++ gcc/config/vxworks/vxworks-predef.h | 32 +++++++++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 gcc/config/vxworks-c.c create mode 100644 gcc/config/vxworks/vxworks-predef.h diff --git a/gcc/config.gcc b/gcc/config.gcc index 5aa0130135f..cf73a853e11 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -955,6 +955,10 @@ case ${target} in xm_defines=POSIX extra_options="${extra_options} vxworks.opt" extra_objs="$extra_objs vxworks.o" + c_target_objs="${c_target_objs} vxworks-c.o" + cxx_target_objs="${cxx_target_objs} vxworks-c.o" + extra_headers="${extra_headers} ../vxworks/vxworks-predef.h" + target_has_targetcm="yes" use_gcc_stdint=provide tm_file="${tm_file} vxworks-stdint.h" case ${enable_threads} in diff --git a/gcc/config/t-vxworks b/gcc/config/t-vxworks index 86b26cc1ecc..69b3a2e3199 100644 --- a/gcc/config/t-vxworks +++ b/gcc/config/t-vxworks @@ -20,6 +20,10 @@ 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) $< +vxworks-c.o: $(srcdir)/config/vxworks-c.c + $(COMPILE) $< + $(POSTCOMPILE) + # 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. diff --git a/gcc/config/vxworks-c.c b/gcc/config/vxworks-c.c new file mode 100644 index 00000000000..0de94e5eefc --- /dev/null +++ b/gcc/config/vxworks-c.c @@ -0,0 +1,37 @@ +/* C-family target hooks initializer for VxWorks targets. + Copyright (C) 2019 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "c-family/c-target.h" +#include "c-family/c-target-def.h" + +/* Implement TARGET_C_PREINCLUDE for vxworks targets. */ + +static const char * +vxworks_c_preinclude (void) +{ + return "vxworks-predef.h"; +} + +#undef TARGET_C_PREINCLUDE +#define TARGET_C_PREINCLUDE vxworks_c_preinclude + +struct gcc_targetcm targetcm = TARGETCM_INITIALIZER; diff --git a/gcc/config/vxworks/vxworks-predef.h b/gcc/config/vxworks/vxworks-predef.h new file mode 100644 index 00000000000..0ea70fb8c73 --- /dev/null +++ b/gcc/config/vxworks/vxworks-predef.h @@ -0,0 +1,32 @@ +/* This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#ifndef _VXWORKS_PREDEF_H +#define _VXWORKS_PREDEF_H 1 + +#define __STDC_IEC_559__ 1 +#define __STDC_IEC_559_COMPLEX__ 1 + +/* Define the value of the following macro to match the value + that the OS actually defines it as. */ +#define __STDC_ISO_10646__ 200009L + +#endif