public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] backends: Handle new RISC-V specific definitions
@ 2022-08-09  7:54 Andreas Schwab
  2022-08-09 17:04 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2022-08-09  7:54 UTC (permalink / raw)
  To: elfutils-devel

Handle PT_RISCV_ATTRIBUTES, SHT_RISCV_ATTRIBUTES, DT_RISCV_VARIANT_CC.

Signed-off-by: Andreas Schwab <schwab@suse.de>
---
 backends/riscv_init.c   |  4 ++++
 backends/riscv_symbol.c | 45 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/backends/riscv_init.c b/backends/riscv_init.c
index 141e0821..f2d46082 100644
--- a/backends/riscv_init.c
+++ b/backends/riscv_init.c
@@ -65,6 +65,10 @@ riscv_init (Elf *elf,
   HOOK (eh, check_special_symbol);
   HOOK (eh, machine_flag_check);
   HOOK (eh, set_initial_registers_tid);
+  HOOK (eh, segment_type_name);
+  HOOK (eh, section_type_name);
+  HOOK (eh, dynamic_tag_name);
+  HOOK (eh, dynamic_tag_check);
   if (eh->class == ELFCLASS64)
     eh->core_note = riscv64_core_note;
   else
diff --git a/backends/riscv_symbol.c b/backends/riscv_symbol.c
index c34b7702..c149b8ba 100644
--- a/backends/riscv_symbol.c
+++ b/backends/riscv_symbol.c
@@ -119,3 +119,48 @@ riscv_check_special_symbol (Elf *elf, const GElf_Sym *sym,
 
   return false;
 }
+
+const char *
+riscv_segment_type_name (int segment, char *buf __attribute__ ((unused)),
+			 size_t len __attribute__ ((unused)))
+{
+  switch (segment)
+    {
+    case PT_RISCV_ATTRIBUTES:
+      return "RISCV_ATTRIBUTES";
+    }
+  return NULL;
+}
+
+/* Return symbolic representation of section type.  */
+const char *
+riscv_section_type_name (int type,
+			 char *buf __attribute__ ((unused)),
+			 size_t len __attribute__ ((unused)))
+{
+  switch (type)
+    {
+    case SHT_RISCV_ATTRIBUTES:
+      return "RISCV_ATTRIBUTES";
+    }
+
+  return NULL;
+}
+
+const char *
+riscv_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)),
+			size_t len __attribute__ ((unused)))
+{
+  switch (tag)
+    {
+    case DT_RISCV_VARIANT_CC:
+      return "RISCV_VARIANT_CC";
+    }
+  return NULL;
+}
+
+bool
+riscv_dynamic_tag_check (int64_t tag)
+{
+  return tag == DT_RISCV_VARIANT_CC;
+}
-- 
2.37.1


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [PATCH] backends: Handle new RISC-V specific definitions
  2022-08-09  7:54 [PATCH] backends: Handle new RISC-V specific definitions Andreas Schwab
@ 2022-08-09 17:04 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2022-08-09 17:04 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: elfutils-devel

On Tue, Aug 09, 2022 at 09:54:28AM +0200, Andreas Schwab wrote:
> Handle PT_RISCV_ATTRIBUTES, SHT_RISCV_ATTRIBUTES, DT_RISCV_VARIANT_CC.

Thanks, looks good. Added a ChangeLog entry and pushed.

Cheers,

Mark

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

end of thread, other threads:[~2022-08-09 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-09  7:54 [PATCH] backends: Handle new RISC-V specific definitions Andreas Schwab
2022-08-09 17:04 ` Mark Wielaard

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