From patchwork Thu Jan 19 22:11:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 92022 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp499982qgi; Thu, 19 Jan 2017 14:13:10 -0800 (PST) X-Received: by 10.55.209.157 with SMTP id o29mr9553807qkl.154.1484863990377; Thu, 19 Jan 2017 14:13:10 -0800 (PST) Return-Path: Received: from bombadil.infradead.org ([65.50.211.133]) by mx.google.com with ESMTPS id y33si3538536qta.17.2017.01.19.14.13.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jan 2017 14:13:10 -0800 (PST) Received-SPF: neutral (google.com: 65.50.211.133 is neither permitted nor denied by best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 65.50.211.133 is neither permitted nor denied by best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cUKxA-0005ZL-MO; Thu, 19 Jan 2017 22:13:08 +0000 Received: from mail-wm0-f46.google.com ([74.125.82.46]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cUKx7-0005Tl-1g for linux-arm-kernel@lists.infradead.org; Thu, 19 Jan 2017 22:13:07 +0000 Received: by mail-wm0-f46.google.com with SMTP id c206so15657174wme.0 for ; Thu, 19 Jan 2017 14:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=9Ckpx3PpesWI4yH0XqDTSNvNkR5jzV3As4bJUcL1DnQ=; b=PpBh1AXrO8H7BjjUqy7nsML0GWnyGLznbYkvtHW0zWLWyFperrU7WD+usuH/lOF1vn Cb0O+Nj8tEKiWUAD0nbBNf9J18EtJbF2NDJiPhxfuH6JmDCPnLlM5Ip/hkZNPPYCAqeV NGjlmfIF/mXuS25H5nOAnfE0tvZrEHgEqWcBk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9Ckpx3PpesWI4yH0XqDTSNvNkR5jzV3As4bJUcL1DnQ=; b=U66X7uLbNZEiCyVikYkXADhK3gClF9kHHQuiCw+cMhf9SNCwV1GbeofH3pXGjpHAZM RHQIXWVYxs8AEgmRJ8TPxdxkzK7ESpqUQomEo62c/ewx3R85Yg99kFpulmMa7f5SIp7V 3kHkrJ2KLxN74khWHVFW0TrZeKeHso1DbTs9Srzm623KR8Rp+Jc9Mkn8fMVSEV0oHv2I +viP/jpc7RX6FTdTlpz0JGERidw6daYU3C6V5iCyImeHZ3vYjCSiPeR6QJMNj26v/Aha B8ZQFCirJpf4mzVhHtnYRvmibGDkqQU3iW1bwB9lJQ3+VbnKIVex3TXSW+BTxYXSJfvh 9fAA== X-Gm-Message-State: AIkVDXKbW/BJmNdCmrDQ7OhVO3UMNeLnMZSKt+CP0m8Ttp3iFyyDBJtEJMpADCIXKCbmrsJf X-Received: by 10.28.126.11 with SMTP id z11mr801768wmc.13.1484863903292; Thu, 19 Jan 2017 14:11:43 -0800 (PST) Received: from localhost.localdomain ([196.72.229.125]) by smtp.gmail.com with ESMTPSA id f67sm1226947wmd.13.2017.01.19.14.11.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Jan 2017 14:11:42 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm: module: add support for R_ARM_REL32 relocations Date: Thu, 19 Jan 2017 22:11:32 +0000 Message-Id: <1484863892-5818-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170119_141305_243407_D6486D2E X-CRM114-Status: GOOD ( 11.24 ) X-Spam-Score: -1.5 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.5 RCVD_IN_SORBS_SPAM RBL: SORBS: sender is a spam source [74.125.82.46 listed in dnsbl.sorbs.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.82.46 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.46 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel , linux@armlinux.org.uk, nico@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Add support for R_ARM_REL32 relocations in the module loader, which will be used by the modversions code when (if) it switches to using relative references to refer to CRC values. Signed-off-by: Ard Biesheuvel --- arch/arm/include/asm/elf.h | 1 + arch/arm/kernel/module.c | 4 ++++ 2 files changed, 5 insertions(+) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index d2315ffd8f12..d450a59ca121 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h @@ -50,6 +50,7 @@ typedef struct user_fp elf_fpregset_t; #define R_ARM_NONE 0 #define R_ARM_PC24 1 #define R_ARM_ABS32 2 +#define R_ARM_REL32 3 #define R_ARM_CALL 28 #define R_ARM_JUMP24 29 #define R_ARM_TARGET1 38 diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index 4f14b5ce6535..29629fe02ce5 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c @@ -159,6 +159,10 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, *(u32 *)loc = offset & 0x7fffffff; break; + case R_ARM_REL32: + *(u32 *)loc += sym->st_value - loc; + break; + case R_ARM_MOVW_ABS_NC: case R_ARM_MOVT_ABS: offset = tmp = __mem_to_opcode_arm(*(u32 *)loc);