linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: <danielmentz@google.com>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-snps-arc@lists.infradead.org>,
	<Alexey.Brodkin@synopsys.com>,
	Vineet Gupta <Vineet.Gupta1@synopsys.com>
Subject: [PATCH 1/3] ARC: module: support R_ARC_32_PCREL relocation
Date: Mon, 19 Sep 2016 14:49:31 -0700	[thread overview]
Message-ID: <1474321773-18166-2-git-send-email-vgupta@synopsys.com> (raw)
In-Reply-To: <1474321773-18166-1-git-send-email-vgupta@synopsys.com>

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
 arch/arc/include/asm/elf.h | 3 +--
 arch/arc/kernel/module.c   | 6 ++++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arc/include/asm/elf.h b/arch/arc/include/asm/elf.h
index 51a99e25fe33..7096f97a1434 100644
--- a/arch/arc/include/asm/elf.h
+++ b/arch/arc/include/asm/elf.h
@@ -23,8 +23,7 @@
 /* ARC Relocations (kernel Modules only) */
 #define  R_ARC_32		0x4
 #define  R_ARC_32_ME		0x1B
-#define  R_ARC_S25H_PCREL	0x10
-#define  R_ARC_S25W_PCREL	0x11
+#define  R_ARC_32_PCREL		0x31
 
 /*to set parameters in the core dumps */
 #define ELF_ARCH		EM_ARCOMPACT
diff --git a/arch/arc/kernel/module.c b/arch/arc/kernel/module.c
index 376e04622962..576a238434a1 100644
--- a/arch/arc/kernel/module.c
+++ b/arch/arc/kernel/module.c
@@ -106,10 +106,12 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
 		 */
 		relo_type = ELF32_R_TYPE(rel_entry[i].r_info);
 
-		if (likely(R_ARC_32_ME == relo_type))
+		if (likely(R_ARC_32_ME == relo_type))	/* ME ( S + A ) */
 			arc_write_me((unsigned short *)location, relocation);
-		else if (R_ARC_32 == relo_type)
+		else if (R_ARC_32 == relo_type)		/* ( S + A ) */
 			*((Elf32_Addr *) location) = relocation;
+		else if (R_ARC_32_PCREL == relo_type)	/* ( S + A ) - PDATA ) */
+			*((Elf32_Addr *) location) = relocation - location;
 		else
 			goto relo_err;
 
-- 
2.7.4

  reply	other threads:[~2016-09-19 21:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-19 21:49 [PATCH 0/3] ARC unwinder switch to .eh_frame Vineet Gupta
2016-09-19 21:49 ` Vineet Gupta [this message]
2016-09-19 21:49 ` [PATCH 2/3] ARC: dw2 unwind: factor CIE specifics for .eh_frame/.debug_frame Vineet Gupta
2016-09-19 21:49 ` [PATCH 3/3] ARC: dw2 unwind: switch to .eh_frame based unwinding Vineet Gupta
2016-09-20  1:21 ` [PATCH 0/3] ARC unwinder switch to .eh_frame Daniel Mentz
2016-09-20  6:13   ` Vineet Gupta
2016-09-22 20:39     ` Vineet Gupta
2016-09-22 20:59   ` modules still have .debug_* (was Re: [PATCH 0/3] ARC unwinder switch to .eh_frame) Vineet Gupta
2016-09-22 22:37     ` Daniel Mentz
2016-09-23 10:38       ` Alexey Brodkin
2016-09-24  1:04         ` Daniel Mentz
2016-09-26 12:38           ` Alexey Brodkin
2016-09-26 18:51             ` Daniel Mentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474321773-18166-2-git-send-email-vgupta@synopsys.com \
    --to=vineet.gupta1@synopsys.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=danielmentz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).