aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-06 00:38:45 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-07-06 02:21:43 +0200
commitabbfd661b2de4c6aedd815b9f653cbe43621b73a (patch)
treeae95844092ef6d853a4a0795ea0a9b3f4bd4097e
parentd2c1cda9f75c7e0244cc3a41f45965f28d3bb9ba (diff)
downloadsparse-abbfd661b2de4c6aedd815b9f653cbe43621b73a.tar.gz
arch: add minimal support for microblaze
The Kernel Test Robot reports a problem on microblaze. The cause is that __MICROBLAZEEL__ is not defined. However, the real problem is that sparse has no support at all for this architecture. So, add the minimal support for microblaze. Link: https://lore.kernel.org/lkml/202007060542.hNfoTcsC%25lkp@intel.com Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--Makefile1
-rw-r--r--machine.h1
-rw-r--r--target-microblaze.c25
-rw-r--r--target.c2
-rw-r--r--target.h1
5 files changed, 30 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index f4483f5a..35098940 100644
--- a/Makefile
+++ b/Makefile
@@ -74,6 +74,7 @@ LIB_OBJS += target-arm64.o
LIB_OBJS += target-bfin.o
LIB_OBJS += target-default.o
LIB_OBJS += target-m68k.o
+LIB_OBJS += target-microblaze.o
LIB_OBJS += target-mips.o
LIB_OBJS += target-nios2.o
LIB_OBJS += target-ppc.o
diff --git a/machine.h b/machine.h
index 02a7f90e..7407e716 100644
--- a/machine.h
+++ b/machine.h
@@ -35,6 +35,7 @@ enum machine {
MACH_ALPHA,
MACH_BFIN,
MACH_M68K,
+ MACH_MICROBLAZE,
MACH_NIOS2,
MACH_UNKNOWN
};
diff --git a/target-microblaze.c b/target-microblaze.c
new file mode 100644
index 00000000..1fbeef3c
--- /dev/null
+++ b/target-microblaze.c
@@ -0,0 +1,25 @@
+#include "symbol.h"
+#include "target.h"
+#include "machine.h"
+
+
+static void predefine_microblaze(const struct target *self)
+{
+ predefine("__MICROBLAZE__", 1, "1");
+ predefine("__microblaze__", 1, "1");
+
+ if (arch_big_endian)
+ predefine("__MICROBLAZEEB__", 1, "1");
+ else
+ predefine("__MICROBLAZEEL__", 1, "1");
+}
+
+const struct target target_microblaze = {
+ .mach = MACH_MICROBLAZE,
+ .bitness = ARCH_LP32,
+ .big_endian = true,
+
+ .bits_in_longdouble = 64,
+
+ .predefine = predefine_microblaze,
+};
diff --git a/target.c b/target.c
index 07c29812..6776c3a1 100644
--- a/target.c
+++ b/target.c
@@ -63,6 +63,7 @@ static const struct target *targets[] = {
[MACH_I386] = &target_i386,
[MACH_BFIN] = &target_bfin,
[MACH_X86_64] = &target_x86_64,
+ [MACH_MICROBLAZE] = &target_microblaze,
[MACH_MIPS32] = &target_mips32,
[MACH_MIPS64] = &target_mips64,
[MACH_NIOS2] = &target_nios2,
@@ -93,6 +94,7 @@ enum machine target_parse(const char *name)
{ "i386", MACH_I386, 32, },
{ "bfin", MACH_BFIN, 32, },
{ "m68k", MACH_M68K, 32, },
+ { "microblaze", MACH_MICROBLAZE,32, },
{ "mips", MACH_MIPS32, 0, },
{ "nios2", MACH_NIOS2, 32, },
{ "powerpc", MACH_PPC32, 0, },
diff --git a/target.h b/target.h
index 3ef0d520..8f79426c 100644
--- a/target.h
+++ b/target.h
@@ -86,6 +86,7 @@ extern const struct target target_arm;
extern const struct target target_arm64;
extern const struct target target_bfin;
extern const struct target target_m68k;
+extern const struct target target_microblaze;
extern const struct target target_mips32;
extern const struct target target_mips64;
extern const struct target target_nios2;