@@ -82,6 +82,7 @@ LIB_OBJS += target-riscv.o
LIB_OBJS += target-s390.o
LIB_OBJS += target-sparc.o
LIB_OBJS += target-x86.o
+LIB_OBJS += target-xtensa.o
LIB_OBJS += tokenize.o
LIB_OBJS += unssa.o
LIB_OBJS += utils.o
@@ -37,6 +37,7 @@ enum machine {
MACH_M68K,
MACH_MICROBLAZE,
MACH_NIOS2,
+ MACH_XTENSA,
MACH_UNKNOWN
};
new file mode 100644
@@ -0,0 +1,31 @@
+#include "symbol.h"
+#include "target.h"
+#include "machine.h"
+
+
+static void init_xtensa(const struct target *self)
+{
+ wchar_ctype = &long_ctype;
+}
+
+static void predefine_xtensa(const struct target *self)
+{
+ predefine("__XTENSA__", 1, "1");
+ predefine("__xtensa__", 1, "1");
+
+ if (arch_big_endian)
+ predefine("__XTENSA_EB__", 1, "1");
+ else
+ predefine("__XTENSA_EL__", 1, "1");
+}
+
+const struct target target_xtensa = {
+ .mach = MACH_XTENSA,
+ .bitness = ARCH_LP32,
+ .big_endian = true,
+
+ .bits_in_longdouble = 64,
+
+ .init = init_xtensa,
+ .predefine = predefine_xtensa,
+};
@@ -76,6 +76,7 @@ static const struct target *targets[] = {
[MACH_SPARC32] = &target_sparc32,
[MACH_SPARC64] = &target_sparc64,
[MACH_X86_64] = &target_x86_64,
+ [MACH_XTENSA] = &target_xtensa,
[MACH_UNKNOWN] = &target_default,
};
const struct target *arch_target = &target_default;
@@ -105,6 +106,7 @@ enum machine target_parse(const char *name)
{ "sparc", MACH_SPARC32, 0, },
{ "x86_64", MACH_X86_64, 64, },
{ "x86-64", MACH_X86_64, 64, },
+ { "xtensa", MACH_XTENSA, 32, },
{ NULL },
};
const struct arch *p;
@@ -100,6 +100,7 @@ extern const struct target target_sparc32;
extern const struct target target_sparc64;
extern const struct target target_i386;
extern const struct target target_x86_64;
+extern const struct target target_xtensa;
/* target.c */
extern const struct target *arch_target;
This is one of the architecture needing a specific predefine set in order to correctly process byteorder.h. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- Makefile | 1 + machine.h | 1 + target-xtensa.c | 31 +++++++++++++++++++++++++++++++ target.c | 2 ++ target.h | 1 + 5 files changed, 36 insertions(+) create mode 100644 target-xtensa.c base-commit: bb372492c40d71cc27952e815612db36aadf65bb