From patchwork Wed May 28 01:23:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 353200 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 15C2A1400D2 for ; Wed, 28 May 2014 11:24:20 +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 :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=mybOe/sjfl+rxYonkCdhpI/VlprY2FyWNDP8t/QACcu1So AzXTfWOOmIruufzJaZzaZSTHuxxktBVsLQFQO4U7zdIgUUbeYR0GwpXNlO2YsZNi kjlpR6p+c8i796SGaLuYRkJpoX2DG5WkdtQ3UEgKuKcpfpV6+CZ7e4xtZ7T9I= 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 :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=lLuJyoNKcqo8aUvejFpkGJLY6fQ=; b=LbMZZjSO7iye1f2qeE9K zzDbgWH3Mjyp4GoTaUYpR4UfJLmbg/96bQRXFoPAbXSU+MK8jXDzlrvsIpixwElr FfYSWIgOqqnvnsf7VfZSNWBRUO4lPMmVFStrnqEQPPNmQ7uz3TPF6MQoyAJ6Tb9/ z+osaDU5FgGFMy/C/ki3j4c= Received: (qmail 9296 invoked by alias); 28 May 2014 01:24:12 -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 9284 invoked by uid 89); 28 May 2014 01:24:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ve0-f174.google.com Received: from mail-ve0-f174.google.com (HELO mail-ve0-f174.google.com) (209.85.128.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 28 May 2014 01:23:56 +0000 Received: by mail-ve0-f174.google.com with SMTP id jw12so11564051veb.5 for ; Tue, 27 May 2014 18:23:54 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.58.228.163 with SMTP id sj3mr31073684vec.28.1401240233888; Tue, 27 May 2014 18:23:53 -0700 (PDT) Received: by 10.58.243.98 with HTTP; Tue, 27 May 2014 18:23:53 -0700 (PDT) Date: Tue, 27 May 2014 18:23:53 -0700 Message-ID: Subject: [Committed/AARCH64] Fix stack protector for ILP32 From: Andrew Pinski To: GCC Patches X-IsSubscribed: yes Hi, I was trying to compile an ilp32 enabled glibc and ran into a failure with stack protector. The problem is two fold. First we were generating the wrong mode for the result to testing against zero. The next issue is we were using 64bit loads instead of 32bit loads from __stack_chk_guard. This was caused by using x instead of in the assembly template. I committed the patch for both of these issues after a build and test on aarch64-linux-gnu with no regressions. Thanks, Andrew Pinski ChangeLog: * config/aarch64/aarch64.md (stack_protect_set_): Use for the register in assembly template. (stack_protect_test): Use the mode of operands[0] for the result. (stack_protect_test_): Use for the register in assembly template. Index: config/aarch64/aarch64.md =================================================================== --- config/aarch64/aarch64.md (revision 210995) +++ config/aarch64/aarch64.md (working copy) @@ -3859,7 +3859,7 @@ (define_insn "stack_protect_set_" UNSPEC_SP_SET)) (set (match_scratch:PTR 2 "=&r") (const_int 0))] "" - "ldr\\t%x2, %1\;str\\t%x2, %0\;mov\t%x2,0" + "ldr\\t%2, %1\;str\\t%2, %0\;mov\t%2,0" [(set_attr "length" "12") (set_attr "type" "multiple")]) @@ -3869,11 +3869,11 @@ (define_expand "stack_protect_test" (match_operand 2)] "" { - - rtx result = gen_reg_rtx (Pmode); - + rtx result; enum machine_mode mode = GET_MODE (operands[0]); + result = gen_reg_rtx(mode); + emit_insn ((mode == DImode ? gen_stack_protect_test_di : gen_stack_protect_test_si) (result, @@ -3896,7 +3896,7 @@ (define_insn "stack_protect_test_" UNSPEC_SP_TEST)) (clobber (match_scratch:PTR 3 "=&r"))] "" - "ldr\t%x3, %x1\;ldr\t%x0, %x2\;eor\t%x0, %x3, %x0" + "ldr\t%3, %x1\;ldr\t%0, %x2\;eor\t%0, %3, %0" [(set_attr "length" "12") (set_attr "type" "multiple")])