From patchwork Sun Jun 8 11:27:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chung-Lin Tang X-Patchwork-Id: 357189 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 1F592140096 for ; Sun, 8 Jun 2014 21:27:27 +1000 (EST) 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=yYjSoLOGCJKun0kKsWIjpVlC3HNfnlCl6ZygO1X9qGb IMffic5R8tC7pvd1brh8yjJECuoFOg0iqRB8/FRkdYvoTxhvQ+4YPTm4dUD+CaDn z+hpfOeU6Hots5EiNQFnhygwcj7vB0Uwd57sHzWVYLS14LTjhvBHMP+8TAF/muAg = 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=e/zlilGj9xF2P2aex/JgpvxXseU=; b=fGd/Zjrgly1SXEUXD 1DKNGy4JSxoBO9PqHZPtIm99LsUHUKmajnLSFM6xMiFTKUwLkgxojxGjuQc98RMC mgPqYvOUZh28DdgEoxItNarLAJt9IEopIOyQ3y3Nb/2jTy2KzrSxu/ltrBGAcyy0 prIk+RKU32YceN/eZpswk1Sbp0= Received: (qmail 30656 invoked by alias); 8 Jun 2014 11:27:19 -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 30644 invoked by uid 89); 8 Jun 2014 11:27:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Jun 2014 11:27:16 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WtbFn-0006nv-1Y from ChungLin_Tang@mentor.com ; Sun, 08 Jun 2014 04:27:11 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sun, 8 Jun 2014 04:27:10 -0700 Received: from [0.0.0.0] (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Sun, 8 Jun 2014 04:27:09 -0700 Message-ID: <5394488D.6060806@codesourcery.com> Date: Sun, 8 Jun 2014 19:27:09 +0800 From: Chung-Lin Tang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: gcc-patches CC: Richard Earnshaw , Ramana Radhakrishnan , Julian Brown Subject: [PATCH, ARM] MI-thunk fix for TARGET_THUMB1_ONLY X-IsSubscribed: yes Hi Richard, Ramana, Attached is a small fix for resolving a g++.old-deja/g++.jason/thunk2.C regression we found under a TARGET_THUMB1_ONLY multilib (-mthumb -march=armv6-m to be exact). Basically under those conditions, the thunk is in Thumb mode, so the subtraction should be 4 rather than 8. Original patch was by Julian, with trivial adaptations for trunk by me. We've been carrying this fix for a while by now. Okay for trunk? (and stable branches?) Thanks, Chung-Lin 2014-06-08 Julian Brown Chung-Lin Tang * config/arm/arm.c (arm_output_mi_thunk): Fix offset for TARGET_THUMB1_ONLY. Add comments. Index: config/arm/arm.c =================================================================== --- config/arm/arm.c (revision 211353) +++ config/arm/arm.c (working copy) @@ -28428,9 +28428,13 @@ arm_output_mi_thunk (FILE *file, tree thunk ATTRIB fputs (":\n", file); if (flag_pic) { - /* Output ".word .LTHUNKn-7-.LTHUNKPCn". */ + /* Output ".word .LTHUNKn-[37]-.LTHUNKPCn". */ rtx tem = XEXP (DECL_RTL (function), 0); - tem = plus_constant (GET_MODE (tem), tem, -7); + /* For TARGET_THUMB1_ONLY the thunk is in Thumb mode, so the PC + pipeline offset is four rather than eight. Adjust the offset + accordingly. */ + tem = plus_constant (GET_MODE (tem), tem, + TARGET_THUMB1_ONLY ? -3 : -7); tem = gen_rtx_MINUS (GET_MODE (tem), tem, gen_rtx_SYMBOL_REF (Pmode,