From patchwork Wed Apr 8 17:47:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Huber X-Patchwork-Id: 1268192 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48yBYw5c3Yz9sQx for ; Thu, 9 Apr 2020 03:47:31 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8431F388700B; Wed, 8 Apr 2020 17:47:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id E4B1A385BF81 for ; Wed, 8 Apr 2020 17:47:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E4B1A385BF81 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sebastian.huber@embedded-brains.de Received: from sslproxy02.your-server.de ([78.47.166.47]) by dedi548.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1jMEnK-0002Ch-Fk for gcc-patches@gcc.gnu.org; Wed, 08 Apr 2020 19:47:22 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy02.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jMEnK-000Dxz-BF for gcc-patches@gcc.gnu.org; Wed, 08 Apr 2020 19:47:22 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 14D072A165B for ; Wed, 8 Apr 2020 19:47:46 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id amJ4ywXLLrBh for ; Wed, 8 Apr 2020 19:47:45 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 99B812A1682 for ; Wed, 8 Apr 2020 19:47:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id b8bvJYa1IKj4 for ; Wed, 8 Apr 2020 19:47:45 +0200 (CEST) Received: from linux-diu0.suse (unknown [192.168.96.161]) by mail.embedded-brains.de (Postfix) with ESMTP id 8100B2A165B for ; Wed, 8 Apr 2020 19:47:45 +0200 (CEST) From: Sebastian Huber To: gcc-patches@gcc.gnu.org Subject: [PATCH] RTEMS: Improve GCC specification Date: Wed, 8 Apr 2020 19:47:21 +0200 Message-Id: <20200408174721.14408-1-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 2.16.4 X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.102.2/25776/Wed Apr 8 14:56:40 2020) X-Spam-Status: No, score=-26.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Add a start/end file specification if the -qrtems option is present. Allow targets to customize it. Support the standard -nodefaultlibs option. gcc/ * config/rtems.h (RTEMS_STARTFILE_SPEC): Define if undefined. (RTEMS_ENDFILE_SPEC): Likewise. (STARTFILE_SPEC): Update comment. Add RTEMS_STARTFILE_SPEC. (ENDFILE_SPEC): Add RTEMS_ENDFILE_SPEC. (LIB_SPECS): Support -nodefaultlibs option. * config/or1k/rtems.h (RTEMS_STARTFILE_SPEC): Define. (RTEMS_ENDFILE_SPEC): Likewise. * config/rs6000/rtems.h (RTEMS_STARTFILE_SPEC): Likewise. (RTEMS_ENDFILE_SPEC): Likewise. * config/v850/rtems.h (RTEMS_STARTFILE_SPEC): Likewise. (RTEMS_ENDFILE_SPEC): Likewise. --- gcc/config/or1k/rtems.h | 3 +++ gcc/config/rs6000/rtems.h | 3 +++ gcc/config/rtems.h | 26 ++++++++++++++++++-------- gcc/config/v850/rtems.h | 3 +++ 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/gcc/config/or1k/rtems.h b/gcc/config/or1k/rtems.h index 94731435f44..d4b8fef3dc7 100644 --- a/gcc/config/or1k/rtems.h +++ b/gcc/config/or1k/rtems.h @@ -28,3 +28,6 @@ builtin_assert ("system=rtems"); \ } \ while (0) + +#define RTEMS_STARTFILE_SPEC "crtbegin%O%s" +#define RTEMS_ENDFILE_SPEC "crtend%O%s" diff --git a/gcc/config/rs6000/rtems.h b/gcc/config/rs6000/rtems.h index 6ce05bfc6d6..40db6606f17 100644 --- a/gcc/config/rs6000/rtems.h +++ b/gcc/config/rs6000/rtems.h @@ -292,3 +292,6 @@ "%{mads|myellowknife|mmvme|msim:%G %L %G;" \ "!mcall-*|mcall-linux:" GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC ";" \ ":%G %L %G}" + +#define RTEMS_STARTFILE_SPEC "ecrti%O%s rtems_crti%O%s crtbegin%O%s" +#define RTEMS_ENDFILE_SPEC "crtend%O%s rtems_crtn%O%s ecrtn%O%s" diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h index 55d568f83b5..30ad6258949 100644 --- a/gcc/config/rtems.h +++ b/gcc/config/rtems.h @@ -22,15 +22,25 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ +#ifndef RTEMS_STARTFILE_SPEC +#define RTEMS_STARTFILE_SPEC "crti%O%s crtbegin%O%s" +#endif + +#ifndef RTEMS_ENDFILE_SPEC +#define RTEMS_ENDFILE_SPEC "crtend%O%s crtn%O%s" +#endif + /* - * Dummy start/end specification to let linker work as - * needed by autoconf scripts using this compiler. + * The crt0.o is a dummy start file to let the linker work as needed by + * autoconf scripts using this compiler. */ #undef STARTFILE_SPEC -#define STARTFILE_SPEC "crt0.o%s" +#define STARTFILE_SPEC "%{!qrtems:crt0%O%s} " \ +"%{qrtems:%{!nostdlib:%{!nostartfiles:" RTEMS_STARTFILE_SPEC "}}}" #undef ENDFILE_SPEC -#define ENDFILE_SPEC "" +#define ENDFILE_SPEC \ +"%{qrtems:%{!nostdlib:%{!nostartfiles:" RTEMS_ENDFILE_SPEC "}}}" /* * Some targets do not set up LIB_SPECS, override it, here. @@ -38,10 +48,10 @@ #define STD_LIB_SPEC "%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}" #undef LIB_SPEC -#define LIB_SPEC "%{!qrtems: " STD_LIB_SPEC "} " \ -"%{!nostdlib: %{qrtems: --start-group \ - -lrtemsbsp -lrtemscpu \ - -latomic -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}" +#define LIB_SPEC "%{!qrtems:" STD_LIB_SPEC "} " \ +"%{qrtems:%{!nostdlib:%{!nodefaultlibs:" \ +"--start-group -lrtemsbsp -lrtemscpu -latomic -lc -lgcc --end-group} " \ +"%{!qnolinkcmds:-T linkcmds%s}}}" #define TARGET_POSIX_IO diff --git a/gcc/config/v850/rtems.h b/gcc/config/v850/rtems.h index 3f7d39a2cd1..e261ea3b417 100644 --- a/gcc/config/v850/rtems.h +++ b/gcc/config/v850/rtems.h @@ -39,3 +39,6 @@ %{!mv850es:%{!mv850e1:%{mv*:-mv%*}} \ %{m8byte-align:-m8byte-align} \ %{mgcc-abi:-mgcc-abi}}" + +#define RTEMS_STARTFILE_SPEC "" +#define RTEMS_ENDFILE_SPEC ""