public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/arm/morello/main] cheri: elf: Prepare support for dynamic relocation processing
@ 2022-10-27 13:58 Szabolcs Nagy
  0 siblings, 0 replies; 3+ messages in thread
From: Szabolcs Nagy @ 2022-10-27 13:58 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6716729644e3ada162b4771b0d5852140142bc42

commit 6716729644e3ada162b4771b0d5852140142bc42
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Thu Oct 20 17:12:36 2022 +0100

    cheri: elf: Prepare support for dynamic relocation processing
    
    Type of relocation addresses must be changed from ElfW(Addr) to
    elfptr_t to cover both traditional and CHERI ABIs.
    
    And relative relocation processing must have access to the link_map
    to derive pointers from the right per module capability.

Diff:
---
 elf/do-rel.h       | 2 +-
 elf/dynamic-link.h | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/elf/do-rel.h b/elf/do-rel.h
index 694b3a6bd7..219fad2318 100644
--- a/elf/do-rel.h
+++ b/elf/do-rel.h
@@ -41,7 +41,7 @@
 
 static inline void __attribute__ ((always_inline))
 elf_dynamic_do_Rel (struct link_map *map, struct r_scope_elem *scope[],
-		    ElfW(Addr) reladdr, ElfW(Addr) relsize,
+		    elfptr_t reladdr, ElfW(Addr) relsize,
 		    __typeof (((ElfW(Dyn) *) 0)->d_un.d_val) nrelative,
 		    int lazy, int skip_ifunc)
 {
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index debbb8c9f7..e189de49eb 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -46,9 +46,14 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
 		  const ElfW(Rela) *reloc, const ElfW(Sym) *sym,
 		  const struct r_found_version *version, void *const reloc_addr,
 		  int skip_ifunc);
+#  ifdef __CHERI_PURE_CAPABILITY__
+static inline void __attribute__((always_inline))
+elf_machine_rela_relative (struct link_map *map, const ElfW(Rela) *reloc);
+#  else
 static inline void __attribute__((always_inline))
 elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
 			   void *const reloc_addr);
+#  endif
 # endif
 # if ELF_MACHINE_NO_RELA || defined ELF_MACHINE_PLT_REL
 static inline void __attribute__((always_inline))
@@ -80,7 +85,7 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
 
 # define _ELF_DYNAMIC_DO_RELOC(RELOC, reloc, map, scope, do_lazy, skip_ifunc, test_rel) \
   do {									      \
-    struct { ElfW(Addr) start, size;					      \
+    struct { elfptr_t start; ElfW(Addr) size;					      \
 	     __typeof (((ElfW(Dyn) *) 0)->d_un.d_val) nrelative; int lazy; }  \
       ranges[2] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 } };			      \
 									      \
@@ -97,7 +102,7 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
     if ((map)->l_info[DT_PLTREL]					      \
 	&& (!test_rel || (map)->l_info[DT_PLTREL]->d_un.d_val == DT_##RELOC)) \
       {									      \
-	ElfW(Addr) start = D_PTR ((map), l_info[DT_JMPREL]);		      \
+	elfptr_t start = D_PTR ((map), l_info[DT_JMPREL]);		      \
 	ElfW(Addr) size = (map)->l_info[DT_PLTRELSZ]->d_un.d_val;	      \
 									      \
 	if (ranges[0].start == 0)					      \

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [glibc/arm/morello/main] cheri: elf: Prepare support for dynamic relocation processing
@ 2022-11-23 14:48 Szabolcs Nagy
  0 siblings, 0 replies; 3+ messages in thread
From: Szabolcs Nagy @ 2022-11-23 14:48 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=046ce0eb112e596fbb5437e809d2f575388e61c1

commit 046ce0eb112e596fbb5437e809d2f575388e61c1
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Thu Oct 20 17:12:36 2022 +0100

    cheri: elf: Prepare support for dynamic relocation processing
    
    Type of relocation addresses must be changed from ElfW(Addr) to
    elfptr_t to cover both traditional and CHERI ABIs.
    
    And relative relocation processing must have access to the link_map
    to derive pointers from the right per module capability.

Diff:
---
 elf/do-rel.h       | 2 +-
 elf/dynamic-link.h | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/elf/do-rel.h b/elf/do-rel.h
index 694b3a6bd7..219fad2318 100644
--- a/elf/do-rel.h
+++ b/elf/do-rel.h
@@ -41,7 +41,7 @@
 
 static inline void __attribute__ ((always_inline))
 elf_dynamic_do_Rel (struct link_map *map, struct r_scope_elem *scope[],
-		    ElfW(Addr) reladdr, ElfW(Addr) relsize,
+		    elfptr_t reladdr, ElfW(Addr) relsize,
 		    __typeof (((ElfW(Dyn) *) 0)->d_un.d_val) nrelative,
 		    int lazy, int skip_ifunc)
 {
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index debbb8c9f7..e189de49eb 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -46,9 +46,14 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
 		  const ElfW(Rela) *reloc, const ElfW(Sym) *sym,
 		  const struct r_found_version *version, void *const reloc_addr,
 		  int skip_ifunc);
+#  ifdef __CHERI_PURE_CAPABILITY__
+static inline void __attribute__((always_inline))
+elf_machine_rela_relative (struct link_map *map, const ElfW(Rela) *reloc);
+#  else
 static inline void __attribute__((always_inline))
 elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
 			   void *const reloc_addr);
+#  endif
 # endif
 # if ELF_MACHINE_NO_RELA || defined ELF_MACHINE_PLT_REL
 static inline void __attribute__((always_inline))
@@ -80,7 +85,7 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
 
 # define _ELF_DYNAMIC_DO_RELOC(RELOC, reloc, map, scope, do_lazy, skip_ifunc, test_rel) \
   do {									      \
-    struct { ElfW(Addr) start, size;					      \
+    struct { elfptr_t start; ElfW(Addr) size;					      \
 	     __typeof (((ElfW(Dyn) *) 0)->d_un.d_val) nrelative; int lazy; }  \
       ranges[2] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 } };			      \
 									      \
@@ -97,7 +102,7 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
     if ((map)->l_info[DT_PLTREL]					      \
 	&& (!test_rel || (map)->l_info[DT_PLTREL]->d_un.d_val == DT_##RELOC)) \
       {									      \
-	ElfW(Addr) start = D_PTR ((map), l_info[DT_JMPREL]);		      \
+	elfptr_t start = D_PTR ((map), l_info[DT_JMPREL]);		      \
 	ElfW(Addr) size = (map)->l_info[DT_PLTRELSZ]->d_un.d_val;	      \
 									      \
 	if (ranges[0].start == 0)					      \

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [glibc/arm/morello/main] cheri: elf: Prepare support for dynamic relocation processing
@ 2022-10-26 15:19 Szabolcs Nagy
  0 siblings, 0 replies; 3+ messages in thread
From: Szabolcs Nagy @ 2022-10-26 15:19 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7ff8b55e3030d555e0bf7bcf82a0fddeae2e1e67

commit 7ff8b55e3030d555e0bf7bcf82a0fddeae2e1e67
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Thu Oct 20 17:12:36 2022 +0100

    cheri: elf: Prepare support for dynamic relocation processing
    
    Type of relocation addresses must be changed from ElfW(Addr) to
    elfptr_t to cover both traditional and CHERI ABIs.
    
    And relative relocation processing must have access to the link_map
    to derive pointers from the right per module capability.

Diff:
---
 elf/do-rel.h       | 2 +-
 elf/dynamic-link.h | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/elf/do-rel.h b/elf/do-rel.h
index 694b3a6bd7..219fad2318 100644
--- a/elf/do-rel.h
+++ b/elf/do-rel.h
@@ -41,7 +41,7 @@
 
 static inline void __attribute__ ((always_inline))
 elf_dynamic_do_Rel (struct link_map *map, struct r_scope_elem *scope[],
-		    ElfW(Addr) reladdr, ElfW(Addr) relsize,
+		    elfptr_t reladdr, ElfW(Addr) relsize,
 		    __typeof (((ElfW(Dyn) *) 0)->d_un.d_val) nrelative,
 		    int lazy, int skip_ifunc)
 {
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index debbb8c9f7..e189de49eb 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -46,9 +46,14 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
 		  const ElfW(Rela) *reloc, const ElfW(Sym) *sym,
 		  const struct r_found_version *version, void *const reloc_addr,
 		  int skip_ifunc);
+#  ifdef __CHERI_PURE_CAPABILITY__
+static inline void __attribute__((always_inline))
+elf_machine_rela_relative (struct link_map *map, const ElfW(Rela) *reloc);
+#  else
 static inline void __attribute__((always_inline))
 elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
 			   void *const reloc_addr);
+#  endif
 # endif
 # if ELF_MACHINE_NO_RELA || defined ELF_MACHINE_PLT_REL
 static inline void __attribute__((always_inline))
@@ -80,7 +85,7 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
 
 # define _ELF_DYNAMIC_DO_RELOC(RELOC, reloc, map, scope, do_lazy, skip_ifunc, test_rel) \
   do {									      \
-    struct { ElfW(Addr) start, size;					      \
+    struct { elfptr_t start; ElfW(Addr) size;					      \
 	     __typeof (((ElfW(Dyn) *) 0)->d_un.d_val) nrelative; int lazy; }  \
       ranges[2] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 } };			      \
 									      \
@@ -97,7 +102,7 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
     if ((map)->l_info[DT_PLTREL]					      \
 	&& (!test_rel || (map)->l_info[DT_PLTREL]->d_un.d_val == DT_##RELOC)) \
       {									      \
-	ElfW(Addr) start = D_PTR ((map), l_info[DT_JMPREL]);		      \
+	elfptr_t start = D_PTR ((map), l_info[DT_JMPREL]);		      \
 	ElfW(Addr) size = (map)->l_info[DT_PLTRELSZ]->d_un.d_val;	      \
 									      \
 	if (ranges[0].start == 0)					      \

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-23 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 13:58 [glibc/arm/morello/main] cheri: elf: Prepare support for dynamic relocation processing Szabolcs Nagy
  -- strict thread matches above, loose matches on Subject: below --
2022-11-23 14:48 Szabolcs Nagy
2022-10-26 15:19 Szabolcs Nagy

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).