From patchwork Fri Nov 11 10:37:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 693628 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 3tFbwS5qQ5z9t1L for ; Fri, 11 Nov 2016 21:38:00 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="VSud/yCJ"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; q=dns; s=default; b=P/l6CTa/GIkMiGOE FB87ybJmf1ZFQU0y9bvaJmLJwVx3F2frsBeGHpEdGTsThkfVnZF2DidizCo/wcUx Fs0EJtsyO1BDKxD9IuphH/l9JNI9Irs/nwoWVN7EAY8L5BhODCJ8qfUmH0TrNXYP 0KExaNLwjUmdP9sSsbQgctruQws= 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:date :from:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; s=default; bh=Fxin4mpRSpFUXdFNAdmHSH 5DxhE=; b=VSud/yCJKgOOmoGN7wWc3DDIGCY2whaaVQC3y+zlmYmsCvU7PURmEh kho8J2EKNm4KPofxUaVe6gSXv42t2He8yns3+Z5rgnCZGYfH+DvFKdQg5SAvaj+3 QJtEKERLWewL1cQDy2SbV2Kg6NGSG1gZcg1Gad60Jhg3JX2mj1Aa0= Received: (qmail 74829 invoked by alias); 11 Nov 2016 10:37:51 -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 74805 invoked by uid 89); 11 Nov 2016 10:37:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=BREAK, OPTION, Hx-languages-length:2345, trapping X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Nov 2016 10:37:48 +0000 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id BBE34C3F26CE4; Fri, 11 Nov 2016 10:37:42 +0000 (GMT) Received: from [10.20.78.79] (10.20.78.79) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server id 14.3.294.0; Fri, 11 Nov 2016 10:37:44 +0000 Date: Fri, 11 Nov 2016 10:37:34 +0000 From: "Maciej W. Rozycki" To: CC: Matthew Fortune , Catherine Moore Subject: [PATCH 2/3] MIPS/GCC/test: Implement `-mcode-readable=yes' option test In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20.17 (DEB 179 2016-10-28) MIME-Version: 1.0 Add an assembly snippet for `mips_option_tests' to verify that instructions executed on the target board may freely access executable sections. Depending on target board's execution environment, which may map executable pages with the Read Inhibit (RI) bit set in the TLB or may have a split SPRAM memory which directs instruction fetch and data read accesses to different parts of the memory, code may or may not be able to access parts of executable sections as data. Therefore verify that data reads from executable sections both complete successfully and that correct data is retrieved (though with a small probability of a false positive). Use MIPS16 execution to access data required as the `-mcode-readable=yes' option only affects MIPS16 code generation anyway, which however simplifies handling a little bit as PC-relative addressing can be used to calculate the location of data required, avoiding any issues if using the PIE or PIC code generation model. Use the BREAK instruction to trap on a comparison check failure so that the effect is immediate and there is no need to wait for the test program to time out; resort to an infinite loop though in the unlikely event a Bp exception handler resumes execution beyond the trapping instruction. NB there is no need to explicitly align data emitted with the `.word' pseudo-op, which is self-aligning. gcc/testsuite/ * gcc.target/mips/mips.exp (mips_option_tests): Add `-mcode-readable=yes' array element. --- OK to apply? Maciej gcc-mips-test-option-tests-mcode-readable-yes.diff Index: gcc/gcc/testsuite/gcc.target/mips/mips.exp =================================================================== --- gcc.orig/gcc/testsuite/gcc.target/mips/mips.exp 2016-11-09 18:56:48.283197623 +0000 +++ gcc/gcc/testsuite/gcc.target/mips/mips.exp 2016-11-11 08:49:53.345912380 +0000 @@ -401,6 +401,27 @@ set mips_option_tests(-mdspr2) { .set dspr2 prepend $2,$3,11 } +set mips_option_tests(-mcode-readable=yes) { + move $2,$31 + bal 1f + .set mips16 + la $3,0f + lw $3,($3) + jr $31 +0: + .word 0xfacebead + .set nomips16 + .align 2 +1: + ori $3,$31,1 + jalr $3 + li $4,0xfacebead + beq $3,$4,2f + break + b . +2: + move $31,$2 +} # Canonicalize command-line option OPTION. proc mips_canonicalize_option { option } {