From patchwork Fri Sep 26 15:04:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jon Medhurst \(Tixy\)" X-Patchwork-Id: 38002 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 45D5620F2E for ; Fri, 26 Sep 2014 15:06:44 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id c13sf6184058eek.7 for ; Fri, 26 Sep 2014 08:06:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:subject:from:to:date :mime-version:cc:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=s/X2gKNtm9RgbgRsgMsQoz8Gw10AHg0e2NxKvCYI8E0=; b=Jp2YmDatWuOjj6WgJGBmV+/9uTnlE4qn1bJsX9wcSMD8ciIqO+e7daaGQ60Cj6Ubr2 PVjjoPFFVkz40FSNJ61nN4T49m2M71fFV2L7FxX/6d/lreezShMjAbcFzEg7FYF6ECqa r6+GaVgfRf+i6q76lZXD2FjSognBLbG1YteveL4aEVHdaiuBH8QJ2HL85a+xzlzZvwJu YxDDH9zRgT65Hef6DqGCzxhA0FxaljWaz5oS7hkS/OKOZeywZY0Wk5l1zSYEkLFm6GqN ZKen0k8HR4GQe4Q8IwLQdWxrrev6YHxgMndvT8oChXo//fG7caFfxH+gXyQCujTHPBa9 XScA== X-Gm-Message-State: ALoCoQkNDtXOjrCRf2NR6pYZA71Gm6bh7pRE06yOWkvAC8FQCisLBOR10ufUrm1PN7avLQArMmPv X-Received: by 10.194.3.19 with SMTP id 19mr354155wjy.5.1411744003455; Fri, 26 Sep 2014 08:06:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.166 with SMTP id an6ls402452lac.71.gmail; Fri, 26 Sep 2014 08:06:43 -0700 (PDT) X-Received: by 10.152.197.35 with SMTP id ir3mr21417411lac.82.1411744003241; Fri, 26 Sep 2014 08:06:43 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com [209.85.215.45]) by mx.google.com with ESMTPS id wn2si7512958lbb.96.2014.09.26.08.06.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Sep 2014 08:06:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id q1so3087797lam.32 for ; Fri, 26 Sep 2014 08:06:43 -0700 (PDT) X-Received: by 10.112.76.6 with SMTP id g6mr19989306lbw.22.1411744003131; Fri, 26 Sep 2014 08:06:43 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp77396lbb; Fri, 26 Sep 2014 08:06:41 -0700 (PDT) X-Received: by 10.70.41.236 with SMTP id i12mr28427285pdl.110.1411744000721; Fri, 26 Sep 2014 08:06:40 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id vm9si9562074pbc.242.2014.09.26.08.06.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Sep 2014 08:06:40 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XXX4l-0002r3-30; Fri, 26 Sep 2014 15:04:51 +0000 Received: from smarthost01b.mail.zen.net.uk ([212.23.1.3]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XXX4i-0002hQ-Py for linux-arm-kernel@lists.infradead.org; Fri, 26 Sep 2014 15:04:49 +0000 Received: from [82.69.122.217] (helo=linaro1) by smarthost01b.mail.zen.net.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XXX4L-00030r-44; Fri, 26 Sep 2014 15:04:25 +0000 Message-ID: <1411743864.1529.36.camel@linaro1.home> Subject: [PATCH] arm: kprobes-test: Fix compile error "bad immediate value for offset" From: "Jon Medhurst (Tixy)" To: Russell King - ARM Linux Date: Fri, 26 Sep 2014 16:04:24 +0100 X-Mailer: Evolution 3.12.2-1+b1 Mime-Version: 1.0 X-Originating-smarthost01b-IP: [82.69.122.217] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140926_080449_014829_E4372403 X-CRM114-Status: GOOD ( 13.67 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.23.1.3 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.23.1.3 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: tixy@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 When compiling kprobes-test-arm.c the following error has been observed /tmp/ccoT403o.s:21439: Error: bad immediate value for offset (4168) This is caused by the compiler spilling it's literal pool too far away from the site which is trying to reference it with a PC relative load. This arises because the compiler is underestimating the size of the inline assembler code present, which apparently it approximates as 4 bytes per line or instruction. We fix this problem by moving the operations which generate more than 4 bytes out of the text section. Specifically, moving the .ascii directives to the .rodata section. Signed-off-by: Jon Medhurst --- Russell, OK to add your 'reported-by' here (or should it be Olof)? arch/arm/kernel/kprobes-test.c | 16 +++++++++------- arch/arm/kernel/kprobes-test.h | 5 ++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c index 08d7312..b206d77 100644 --- a/arch/arm/kernel/kprobes-test.c +++ b/arch/arm/kernel/kprobes-test.c @@ -110,10 +110,13 @@ * * @ TESTCASE_START * bl __kprobes_test_case_start - * @ start of inline data... + * .pushsection .rodata + * "10: * .ascii "mov r0, r7" @ text title for test case * .byte 0 - * .align 2, 0 + * .popsection + * @ start of inline data... + * .word 10b @ pointer to title in .rodata section * * @ TEST_ARG_REG * .byte ARG_TYPE_REG @@ -971,7 +974,7 @@ void __naked __kprobes_test_case_start(void) __asm__ __volatile__ ( "stmdb sp!, {r4-r11} \n\t" "sub sp, sp, #"__stringify(TEST_MEMORY_SIZE)"\n\t" - "bic r0, lr, #1 @ r0 = inline title string \n\t" + "bic r0, lr, #1 @ r0 = inline data \n\t" "mov r1, sp \n\t" "bl kprobes_test_case_start \n\t" "bx r0 \n\t" @@ -1349,15 +1352,14 @@ static unsigned long next_instruction(unsigned long pc) return pc + 4; } -static uintptr_t __used kprobes_test_case_start(const char *title, void *stack) +static uintptr_t __used kprobes_test_case_start(const char **title, void *stack) { struct test_arg *args; struct test_arg_end *end_arg; unsigned long test_code; - args = (struct test_arg *)PTR_ALIGN(title + strlen(title) + 1, 4); - - current_title = title; + current_title = *title++; + args = (struct test_arg *)title; current_args = args; current_stack = stack; diff --git a/arch/arm/kernel/kprobes-test.h b/arch/arm/kernel/kprobes-test.h index eecc90a..4430990 100644 --- a/arch/arm/kernel/kprobes-test.h +++ b/arch/arm/kernel/kprobes-test.h @@ -111,11 +111,14 @@ struct test_arg_end { #define TESTCASE_START(title) \ __asm__ __volatile__ ( \ "bl __kprobes_test_case_start \n\t" \ + ".pushsection .rodata \n\t" \ + "10: \n\t" \ /* don't use .asciz here as 'title' may be */ \ /* multiple strings to be concatenated. */ \ ".ascii "#title" \n\t" \ ".byte 0 \n\t" \ - ".align 2, 0 \n\t" + ".popsection \n\t" \ + ".word 10b \n\t" #define TEST_ARG_REG(reg, val) \ ".byte "__stringify(ARG_TYPE_REG)" \n\t" \