From patchwork Wed Nov 19 13:50:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Bruel X-Patchwork-Id: 412396 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 56612140142 for ; Thu, 20 Nov 2014 00:50:59 +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 :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=x0ObaGdkuamXzPbQvfI4eH3kVH8+dt1Wqe+ZjlpSchJ YmvwwstVwDGHzl/CgbfdloKPiXrYY7Ho9EA4jokxp86qOdDXJ7b+iEIwkbUr6RnF mFXbJnEXfxmIpmmD4dhcUSMolVZe17tFXJ4i6WhKB7DLr31qGjsBlxIBXR/aLbEw = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=RCK2jD46kfwOCSv/Kx7E21D4voM=; b=jQnTsXttB/YqFkM8d cMRMGNbyZXDuWerKCCv8LsDPwqKStLSioeX+rZci2xVEsOMTqvbHpDaRnBB0pI2+ 5MjqWfJLM9xHHABfI9FuavvkuahsUS+Tp9fu8dOt2T1+7JeGX8VezdGxO0RYzo1b XUkPFhq8ARWLgmJPF0jZmn+pvg= Received: (qmail 21525 invoked by alias); 19 Nov 2014 13:50:41 -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 21454 invoked by uid 89); 19 Nov 2014 13:50:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mx08-00178001.pphosted.com Received: from mx08-00178001.pphosted.com (HELO mx08-00178001.pphosted.com) (91.207.212.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 19 Nov 2014 13:50:37 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id sAJDianT001602; Wed, 19 Nov 2014 14:50:32 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 1qr7emd34a-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 19 Nov 2014 14:50:32 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 6004C31; Wed, 19 Nov 2014 13:50:00 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas4.st.com [10.75.90.69]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 1AE982D42C; Wed, 19 Nov 2014 13:50:30 +0000 (GMT) Received: from [164.129.122.197] (164.129.122.197) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.3.342.0; Wed, 19 Nov 2014 14:50:29 +0100 Message-ID: <546CA025.1060007@st.com> Date: Wed, 19 Nov 2014 14:50:29 +0100 From: Christian Bruel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: ramana Radhakrishnan Cc: Richard Earnshaw , Terry Guo , "gcc-patches@gcc.gnu.org" Subject: [PATCH, ARM] attribute target (thumb,arm) [4/6] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.28, 0.0.0000 definitions=2014-11-19_04:2014-11-19, 2014-11-19, 1970-01-01 signatures=0 X-IsSubscribed: yes Implements and document the hooks to support target_attributes. The emission of blx is handled directly for armv5 to overcome a bug with the current binutils that fails with calls to a static symbol in a different section. (e.g .text -> .text.startup) in different modes. (ref https://sourceware.org/bugzilla/show_bug.cgi?id=17505) Regtests included Thanks Christian 2014-09-23 Christian Bruel * gcc.target/arm/attr_arm.c: New test. * gcc.target/arm/attr_thumb.c: New test. * gcc.target/arm/attr_thumb-static.c: New test. diff '--exclude=ChangeLog*' '--exclude=.svn' '--exclude=*~' '--exclude=#*#' -rupN d/gcc/gcc/testsuite/gcc.target/arm/attr_arm.c e/gcc/gcc/testsuite/gcc.target/arm/attr_arm.c --- d/gcc/gcc/testsuite/gcc.target/arm/attr_arm.c 1970-01-01 01:00:00.000000000 +0100 +++ e/gcc/gcc/testsuite/gcc.target/arm/attr_arm.c 2014-11-18 10:56:51.000000000 +0100 @@ -0,0 +1,13 @@ +/* Check that attribute target arm is recogniwed. */ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arm_ok } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler ".arm" } } */ +/* { dg-final { scan-assembler-not "ite" } } */ + +int __attribute__((target("arm"))) +foo(int a) +{ + return a ? 1 : 5; +} + diff '--exclude=ChangeLog*' '--exclude=.svn' '--exclude=*~' '--exclude=#*#' -rupN d/gcc/gcc/testsuite/gcc.target/arm/attr_arm-err.c e/gcc/gcc/testsuite/gcc.target/arm/attr_arm-err.c --- d/gcc/gcc/testsuite/gcc.target/arm/attr_arm-err.c 1970-01-01 01:00:00.000000000 +0100 +++ e/gcc/gcc/testsuite/gcc.target/arm/attr_arm-err.c 2014-11-18 10:56:19.000000000 +0100 @@ -0,0 +1,12 @@ +/* Check that attribute target arm is rejected for M profile. */ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arm_ok } */ +/* { dg-add-options arm_arch_v6m } */ + +int __attribute__((target("arm"))) +foo(int a) +{ /* { dg-error "does not support" } */ + return a ? 1 : 5; +} + + diff '--exclude=ChangeLog*' '--exclude=.svn' '--exclude=*~' '--exclude=#*#' -rupN d/gcc/gcc/testsuite/gcc.target/arm/attr_thumb.c e/gcc/gcc/testsuite/gcc.target/arm/attr_thumb.c --- d/gcc/gcc/testsuite/gcc.target/arm/attr_thumb.c 1970-01-01 01:00:00.000000000 +0100 +++ e/gcc/gcc/testsuite/gcc.target/arm/attr_thumb.c 2014-11-18 11:02:25.000000000 +0100 @@ -0,0 +1,13 @@ +/* Check that attribute target thumb is recogniwed. */ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler ".thumb" } } */ +/* { dg-final { scan-assembler "ite" } } */ + +int __attribute__((target("thumb"))) +foo(int a) +{ + return a ? 1 : 5; +} + diff '--exclude=ChangeLog*' '--exclude=.svn' '--exclude=*~' '--exclude=#*#' -rupN d/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static.c e/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static.c --- d/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static.c 1970-01-01 01:00:00.000000000 +0100 +++ e/gcc/gcc/testsuite/gcc.target/arm/attr_thumb-static.c 2014-11-18 11:02:22.000000000 +0100 @@ -0,0 +1,24 @@ +/* Check that a change mode to a static function is correctly handled. */ +/* { dg-do run } */ +/* { dg-require-effective-target arm_thumb1_ok } */ + +static void + __attribute__((__noinline__)) +foo (void) +{ + __asm__ (""); +} + +static void +__attribute__((__noinline__)) +__attribute__((target("thumb"))) +bar (void) +{ + __asm__ (""); +} + +int main() +{ + foo(); + bar(); +}