summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2022-08-09 09:54:28 +0200
committerMark Wielaard <mark@klomp.org>2022-08-09 18:40:33 +0200
commitd703772ee51ff9171e0b4f09e1b1d7c96369f9b9 (patch)
treea72b4605495fa4a5b080cdc666135927c04c6631
parentde209d23e5f571f03ff0efc6547a2ebbfae3828e (diff)
downloadelfutils-d703772ee51ff9171e0b4f09e1b1d7c96369f9b9.tar.gz
backends: Handle new RISC-V specific definitions
Handle PT_RISCV_ATTRIBUTES, SHT_RISCV_ATTRIBUTES, DT_RISCV_VARIANT_CC. Signed-off-by: Andreas Schwab <schwab@suse.de>
-rw-r--r--backends/ChangeLog9
-rw-r--r--backends/riscv_init.c4
-rw-r--r--backends/riscv_symbol.c45
3 files changed, 58 insertions, 0 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog
index 495cdde4..5b0daffe 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,12 @@
+2022-08-09 Andreas Schwab <schwab@suse.de>
+
+ * riscv_init.c (riscv_init): HOOK segment_type_name,
+ section_type_name, dynamic_tag_name and dynamic_tag_check.
+ * riscv_symbol.c (riscv_segment_type_name): New function.
+ (riscv_section_type_name): Likewise.
+ (riscv_dynamic_tag_name): Likewise.
+ (riscv_dynamic_tag_check): Likewise.
+
2022-06-01 Ulrich Drepper <drepper@redhat.com>
* Makefile.am (arm_SRCS): Add arm_machineflagname.c.
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;
+}