public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] riscv: Use elf_machine_rela_relative to handle R_RISCV_RELATIVE
Date: Fri, 24 Jun 2022 04:10:25 +0000 (GMT)	[thread overview]
Message-ID: <20220624041025.D17C6385697C@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=58fc66a91ca511cc12901cb599914f31948e02d5

commit 58fc66a91ca511cc12901cb599914f31948e02d5
Author: Kito Cheng <kito.cheng@sifive.com>
Date:   Thu Jun 23 23:47:04 2022 +0800

    riscv: Use elf_machine_rela_relative to handle R_RISCV_RELATIVE
    
    Minor clean-up, we need to change this part in following patch, clean this up
    to prevent we duplicated the change twice.
    
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

Diff:
---
 sysdeps/riscv/dl-machine.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h
index a60a452952..4bb858adaa 100644
--- a/sysdeps/riscv/dl-machine.h
+++ b/sysdeps/riscv/dl-machine.h
@@ -152,6 +152,14 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t t,
 
 #ifdef RESOLVE_MAP
 
+static inline void
+__attribute__ ((always_inline))
+elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
+			  void *const reloc_addr)
+{
+  *(ElfW(Addr) *) reloc_addr = l_addr + reloc->r_addend;
+}
+
 /* Perform a relocation described by R_INFO at the location pointed to
    by RELOC_ADDR.  SYM is the relocation symbol specified by R_INFO and
    MAP is the object containing the reloc.  */
@@ -182,7 +190,7 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
   switch (r_type)
     {
     case R_RISCV_RELATIVE:
-      *addr_field = map->l_addr + reloc->r_addend;
+      elf_machine_rela_relative (map->l_addr, reloc, addr_field);
       break;
     case R_RISCV_JUMP_SLOT:
     case __WORDSIZE == 64 ? R_RISCV_64 : R_RISCV_32:
@@ -258,14 +266,6 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
     }
 }
 
-static inline void
-__attribute__ ((always_inline))
-elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
-			  void *const reloc_addr)
-{
-  *(ElfW(Addr) *) reloc_addr = l_addr + reloc->r_addend;
-}
-
 static inline void
 __attribute__ ((always_inline))
 elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],


                 reply	other threads:[~2022-06-24  4:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220624041025.D17C6385697C@sourceware.org \
    --to=palmer@sourceware.org \
    --cc=glibc-cvs@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).