From patchwork Fri Nov 4 12:57:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Huber X-Patchwork-Id: 123629 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 49A11B6F6F for ; Fri, 4 Nov 2011 23:57:59 +1100 (EST) Received: (qmail 20814 invoked by alias); 4 Nov 2011 12:57:57 -0000 Received: (qmail 20803 invoked by uid 22791); 4 Nov 2011 12:57:56 -0000 X-SWARE-Spam-Status: No, hits=0.9 required=5.0 tests=AWL, BAYES_50, RDNS_DYNAMIC, TW_IV, T_FILL_THIS_FORM_SHORT X-Spam-Check-By: sourceware.org Received: from host-82-135-62-35.customer.m-online.net (HELO mail.embedded-brains.de) (82.135.62.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Nov 2011 12:57:40 +0000 Received: by mail.embedded-brains.de (Postfix, from userid 65534) id C051E6525F0; Fri, 4 Nov 2011 13:57:37 +0100 (CET) Received: from [192.168.96.31] (eb0011.eb.z [192.168.96.31]) by mail.embedded-brains.de (Postfix) with ESMTP id 562596525EE; Fri, 4 Nov 2011 13:57:35 +0100 (CET) Message-ID: <4EB3E13F.9000903@embedded-brains.de> Date: Fri, 04 Nov 2011 13:57:35 +0100 From: Sebastian Huber User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110920 SUSE/3.1.15 Lightning/1.0b2 Thunderbird/3.1.15 MIME-Version: 1.0 To: Ramana Radhakrishnan CC: gcc-patches@gcc.gnu.org Subject: Re: [Patch] ARM EABI support for RTEMS References: <4EB3B2A9.70805@embedded-brains.de> In-Reply-To: X-IsSubscribed: yes 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 Hello Ramana, thanks for the quick review. On 11/04/2011 12:43 PM, Ramana Radhakrishnan wrote: >> /home/sh/archive/gcc-4.7-20111029/libgcc/unwind-dw2.c: In function >> 'init_dwarf_reg_size_table': >> /home/sh/archive/gcc-4.7-20111029/libgcc/unwind-dw2.c:1482:39: internal >> compiler error: in arm_dbx_register_number, at config/arm/arm.c:23536 > > Your original post in this thread suggested that you wanted to switch > the rtems port to use the AAPCS > http://gcc.gnu.org/ml/gcc/2011-04/msg00100.html . > > If the above is what was intended this is not the right way of > achieving it because you are missing an include of bpabi.h which sets > ARM_DEFAULT_ABI to ARM_ABI_AAPCS and a raft of other pre-processor > defines that you need to get the backend in the right form for using > the AAPCS implementation. Yes, the above is what was intended. The bpabi.h is provided by the common EABI part in the gcc/config.gcc section. > The other problem is that you aren't using > the right unwind info which is why you are hitting this issue because > it just uses the standard eh_frame implementation .Look at how this is > done in libgcc/config.host. Thanks for the hint. This libgcc/config.host part seems to be new in GCC 4.7. Attached is a new patch. It builds well and the test suite runs currently. Kind regards, Sebastian 2011-11-04 Sebastian Huber * gcc/config.gcc (arm*-*-rtemseabi*): New target. * gcc/config/arm/rtems-eabi.h: New. * gcc/config/arm/t-rtems-eabi: New. * libgcc/config.host (arm*-*-rtemseabi*): New target. diff --git a/gcc/config.gcc b/gcc/config.gcc index 2c18655..a1e7a6d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -904,7 +904,7 @@ arm*-*-ecos-elf) tm_file="dbxelf.h elfos.h newlib-stdint.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/ecos-elf.h" tmake_file="arm/t-arm arm/t-arm-elf" ;; -arm*-*-eabi* | arm*-*-symbianelf* ) +arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi*) # The BPABI long long divmod functions return a 128-bit value in # registers r0-r3. Correctly modeling that requires the use of # TImode. @@ -919,6 +919,10 @@ arm*-*-eabi* | arm*-*-symbianelf* ) tmake_file="${tmake_file} arm/t-bpabi" use_gcc_stdint=wrap ;; + arm*-*-rtemseabi*) + tm_file="${tm_file} rtems.h arm/rtems-eabi.h newlib-stdint.h" + tmake_file="${tmake_file} arm/t-bpabi t-rtems arm/t-rtems-eabi" + ;; arm*-*-symbianelf*) tm_file="${tm_file} arm/symbian.h" libgcc_tm_file="$libgcc_tm_file arm/symbian-lib.h" diff --git a/gcc/config/arm/rtems-eabi.h b/gcc/config/arm/rtems-eabi.h new file mode 100644 index 0000000..ced98a9 --- /dev/null +++ b/gcc/config/arm/rtems-eabi.h @@ -0,0 +1,29 @@ +/* Definitions for RTEMS based ARM systems using EABI. + Copyright (C) 2011 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 + . */ + +#define HAS_INIT_SECTION + +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define ("__rtems__"); \ + builtin_define ("__USE_INIT_FINI__"); \ + builtin_assert ("system=rtems"); \ + TARGET_BPABI_CPP_BUILTINS(); \ + } while (0) diff --git a/gcc/config/arm/t-rtems-eabi b/gcc/config/arm/t-rtems-eabi new file mode 100644 index 0000000..f0e714a --- /dev/null +++ b/gcc/config/arm/t-rtems-eabi @@ -0,0 +1,8 @@ +# Custom RTEMS EABI multilibs + +MULTILIB_OPTIONS = mthumb march=armv6-m/march=armv7/march=armv7-m +MULTILIB_DIRNAMES = thumb armv6-m armv7 armv7-m +MULTILIB_EXCEPTIONS = march=armv6-m march=armv7 march=armv7-m +MULTILIB_MATCHES = +MULTILIB_EXCLUSIONS = +MULTILIB_OSDIRNAMES = diff --git a/libgcc/config.host b/libgcc/config.host index 08c00a3..57b044a 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -300,10 +300,10 @@ arm*-*-uclinux*) # ARM ucLinux arm*-*-ecos-elf) tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" ;; -arm*-*-eabi* | arm*-*-symbianelf* ) +arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtemseabi*) tmake_file="${tmake_file} t-fixedpoint-gnu-prefix" case ${host} in - arm*-*-eabi*) + arm*-*-eabi* | arm*-*-rtemseabi*) tmake_file="${tmake_file} arm/t-bpabi" ;; arm*-*-symbianelf*)