aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-10 14:21:21 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-13 18:02:55 +0200
commit13f4aefdb21d033f0b56fdcf111473781348217f (patch)
treec9470308aa6de69b78e874174f76ef1f43fd1010
parent338f93fad2fb41198abb6fa6d8a9e4a28a86e55e (diff)
downloadsparse-13f4aefdb21d033f0b56fdcf111473781348217f.tar.gz
openrisc: add minimal support
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--Makefile1
-rw-r--r--machine.h1
-rw-r--r--target-openrisc.c26
-rw-r--r--target.c2
-rw-r--r--target.h1
5 files changed, 31 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 46bdb0e6..fea2d74f 100644
--- a/Makefile
+++ b/Makefile
@@ -79,6 +79,7 @@ LIB_OBJS += target-microblaze.o
LIB_OBJS += target-mips.o
LIB_OBJS += target-nds32.o
LIB_OBJS += target-nios2.o
+LIB_OBJS += target-openrisc.o
LIB_OBJS += target-ppc.o
LIB_OBJS += target-riscv.o
LIB_OBJS += target-s390.o
diff --git a/machine.h b/machine.h
index 170bdb50..e3433739 100644
--- a/machine.h
+++ b/machine.h
@@ -39,6 +39,7 @@ enum machine {
MACH_MICROBLAZE,
MACH_NDS32,
MACH_NIOS2,
+ MACH_OPENRISC,
MACH_SH,
MACH_XTENSA,
MACH_UNKNOWN
diff --git a/target-openrisc.c b/target-openrisc.c
new file mode 100644
index 00000000..553963c0
--- /dev/null
+++ b/target-openrisc.c
@@ -0,0 +1,26 @@
+#include "symbol.h"
+#include "target.h"
+#include "machine.h"
+
+
+static void init_openrisc(const struct target *self)
+{
+ wchar_ctype = &uint_ctype;
+}
+
+static void predefine_openrisc(const struct target *self)
+{
+ predefine_weak("__OR1K__");
+ predefine_weak("__or1k__");
+}
+
+const struct target target_openrisc = {
+ .mach = MACH_NDS32,
+ .bitness = ARCH_LP32,
+ .big_endian = true,
+
+ .bits_in_longdouble = 64,
+
+ .init = init_openrisc,
+ .predefine = predefine_openrisc,
+};
diff --git a/target.c b/target.c
index 857ae367..10914846 100644
--- a/target.c
+++ b/target.c
@@ -69,6 +69,7 @@ static const struct target *targets[] = {
[MACH_MIPS64] = &target_mips64,
[MACH_NDS32] = &target_nds32,
[MACH_NIOS2] = &target_nios2,
+ [MACH_OPENRISC] = &target_openrisc,
[MACH_PPC32] = &target_ppc32,
[MACH_PPC64] = &target_ppc64,
[MACH_RISCV32] = &target_riscv32,
@@ -103,6 +104,7 @@ enum machine target_parse(const char *name)
{ "mips", MACH_MIPS32, 0, },
{ "nds32", MACH_NDS32, 32, },
{ "nios2", MACH_NIOS2, 32, },
+ { "openrisc", MACH_OPENRISC, 32, },
{ "powerpc", MACH_PPC32, 0, },
{ "ppc", MACH_PPC32, 0, },
{ "riscv", MACH_RISCV32, 0, },
diff --git a/target.h b/target.h
index 8eb52806..2ce88413 100644
--- a/target.h
+++ b/target.h
@@ -92,6 +92,7 @@ extern const struct target target_mips32;
extern const struct target target_mips64;
extern const struct target target_nds32;
extern const struct target target_nios2;
+extern const struct target target_openrisc;
extern const struct target target_ppc32;
extern const struct target target_ppc64;
extern const struct target target_riscv32;