Supporting even more architectures in standalone libasm
This commit is contained in:
parent
78435b601f
commit
32da9a3eb3
7
Makefile
7
Makefile
|
@ -142,6 +142,13 @@ dist:
|
|||
$(PACKAGE)-$(VERSION)/tests/tests.sh \
|
||||
$(PACKAGE)-$(VERSION)/tests/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/tools/arch.c \
|
||||
$(PACKAGE)-$(VERSION)/tools/arch/arm.c \
|
||||
$(PACKAGE)-$(VERSION)/tools/arch/armeb.c \
|
||||
$(PACKAGE)-$(VERSION)/tools/arch/armel.c \
|
||||
$(PACKAGE)-$(VERSION)/tools/arch/i386.c \
|
||||
$(PACKAGE)-$(VERSION)/tools/arch/i486.c \
|
||||
$(PACKAGE)-$(VERSION)/tools/arch/i586.c \
|
||||
$(PACKAGE)-$(VERSION)/tools/arch/i686.c \
|
||||
$(PACKAGE)-$(VERSION)/tools/format.c \
|
||||
$(PACKAGE)-$(VERSION)/tools/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/tools/project.conf \
|
||||
|
|
|
@ -18,7 +18,7 @@ INSTALL ?= install
|
|||
|
||||
all: $(TARGETS)
|
||||
|
||||
libasm_OBJS = arch.o format.o
|
||||
libasm_OBJS = arch.o arch/arm.o arch/armeb.o arch/armel.o arch/i386.o arch/i486.o arch/i586.o arch/i686.o format.o
|
||||
libasm_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
|
||||
libasm_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) ../src/asm.o ../src/code.o ../src/parser.o ../src/token.o `pkg-config --libs cpp`
|
||||
|
||||
|
@ -34,6 +34,27 @@ libasm.so.0.0 libasm.so.0 libasm.so: $(libasm_OBJS)
|
|||
arch.o: arch.c ../src/arch.c
|
||||
$(CC) $(libasm_CFLAGS) -c arch.c
|
||||
|
||||
arch/arm.o: arch/arm.c
|
||||
$(CC) $(libasm_CFLAGS) -o arch/arm.o -c arch/arm.c
|
||||
|
||||
arch/armeb.o: arch/armeb.c
|
||||
$(CC) $(libasm_CFLAGS) -o arch/armeb.o -c arch/armeb.c
|
||||
|
||||
arch/armel.o: arch/armel.c
|
||||
$(CC) $(libasm_CFLAGS) -o arch/armel.o -c arch/armel.c
|
||||
|
||||
arch/i386.o: arch/i386.c
|
||||
$(CC) $(libasm_CFLAGS) -o arch/i386.o -c arch/i386.c
|
||||
|
||||
arch/i486.o: arch/i486.c
|
||||
$(CC) $(libasm_CFLAGS) -o arch/i486.o -c arch/i486.c
|
||||
|
||||
arch/i586.o: arch/i586.c
|
||||
$(CC) $(libasm_CFLAGS) -o arch/i586.o -c arch/i586.c
|
||||
|
||||
arch/i686.o: arch/i686.c
|
||||
$(CC) $(libasm_CFLAGS) -o arch/i686.o -c arch/i686.c
|
||||
|
||||
format.o: format.c ../src/format.c
|
||||
$(CC) $(libasm_CFLAGS) -c format.c
|
||||
|
||||
|
|
63
tools/arch.c
63
tools/arch.c
|
@ -19,48 +19,10 @@
|
|||
#include "../src/arch/amd64.c"
|
||||
#undef arch_plugin
|
||||
|
||||
#if 0
|
||||
#define arch_plugin arch_plugin_arm
|
||||
#include "../src/arch/arm.c"
|
||||
#undef arch_plugin
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#define arch_plugin arch_plugin_armeb
|
||||
#include "../src/arch/armeb.c"
|
||||
#undef arch_plugin
|
||||
|
||||
#define arch_plugin arch_plugin_armel
|
||||
#include "../src/arch/armel.c"
|
||||
#undef arch_plugin
|
||||
#endif
|
||||
|
||||
#define arch_plugin arch_plugin_dalvik
|
||||
#include "../src/arch/dalvik.c"
|
||||
#undef arch_plugin
|
||||
|
||||
#if 0
|
||||
#define arch_plugin arch_plugin_i386
|
||||
#include "../src/arch/i386.c"
|
||||
#undef arch_plugin
|
||||
|
||||
#define arch_plugin arch_plugin_i386_real
|
||||
#include "../src/arch/i386_real.c"
|
||||
#undef arch_plugin
|
||||
|
||||
#define arch_plugin arch_plugin_i486
|
||||
#include "../src/arch/i486.c"
|
||||
#undef arch_plugin
|
||||
|
||||
#define arch_plugin arch_plugin_i586
|
||||
#include "../src/arch/i586.c"
|
||||
#undef arch_plugin
|
||||
|
||||
#define arch_plugin arch_plugin_i686
|
||||
#include "../src/arch/i686.c"
|
||||
#undef arch_plugin
|
||||
#endif
|
||||
|
||||
#define arch_plugin arch_plugin_java
|
||||
#include "../src/arch/java.c"
|
||||
#undef arch_plugin
|
||||
|
@ -107,14 +69,29 @@
|
|||
/* AsmArch */
|
||||
/* private */
|
||||
/* constants */
|
||||
static const struct
|
||||
extern AsmArchPlugin arch_plugin_arm;
|
||||
extern AsmArchPlugin arch_plugin_armeb;
|
||||
extern AsmArchPlugin arch_plugin_armel;
|
||||
extern AsmArchPlugin arch_plugin_i386;
|
||||
extern AsmArchPlugin arch_plugin_i486;
|
||||
extern AsmArchPlugin arch_plugin_i586;
|
||||
extern AsmArchPlugin arch_plugin_i686;
|
||||
|
||||
static struct
|
||||
{
|
||||
char const * name;
|
||||
AsmArchPlugin * plugin;
|
||||
} _arch[] =
|
||||
{
|
||||
{ "amd64", &arch_plugin_amd64 },
|
||||
{ "arm", NULL },
|
||||
{ "armeb", NULL },
|
||||
{ "armel", NULL },
|
||||
{ "dalvik", &arch_plugin_dalvik },
|
||||
{ "i386", NULL },
|
||||
{ "i486", NULL },
|
||||
{ "i586", NULL },
|
||||
{ "i686", NULL },
|
||||
{ "java", &arch_plugin_java },
|
||||
{ "mips", &arch_plugin_mips },
|
||||
{ "sparc", &arch_plugin_sparc },
|
||||
|
@ -135,6 +112,14 @@ AsmArch * arch_new(char const * name)
|
|||
#ifdef DEBUG
|
||||
fprintf(stderr, "DEBUG: %s(\"%s\")\n", __func__, name);
|
||||
#endif
|
||||
/* XXX */
|
||||
_arch[1].plugin = &arch_plugin_arm;
|
||||
_arch[2].plugin = &arch_plugin_armeb;
|
||||
_arch[3].plugin = &arch_plugin_armel;
|
||||
_arch[5].plugin = &arch_plugin_i386;
|
||||
_arch[6].plugin = &arch_plugin_i486;
|
||||
_arch[7].plugin = &arch_plugin_i586;
|
||||
_arch[8].plugin = &arch_plugin_i686;
|
||||
for(i = 0; i < sizeof(_arch) / sizeof(*_arch); i++)
|
||||
if(strcmp(_arch[i].name, name) == 0)
|
||||
{
|
||||
|
|
19
tools/arch/arm.c
Normal file
19
tools/arch/arm.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel Asm */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#define arch_plugin arch_plugin_arm
|
||||
#include "../src/arch/arm.c"
|
19
tools/arch/armeb.c
Normal file
19
tools/arch/armeb.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel Asm */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#define arch_plugin arch_plugin_armeb
|
||||
#include "../src/arch/armeb.c"
|
19
tools/arch/armel.c
Normal file
19
tools/arch/armel.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel Asm */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#define arch_plugin arch_plugin_armel
|
||||
#include "../src/arch/armel.c"
|
19
tools/arch/i386.c
Normal file
19
tools/arch/i386.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel Asm */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#define arch_plugin arch_plugin_i386
|
||||
#include "../src/arch/i386.c"
|
19
tools/arch/i486.c
Normal file
19
tools/arch/i486.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel Asm */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#define arch_plugin arch_plugin_i486
|
||||
#include "../src/arch/i486.c"
|
19
tools/arch/i586.c
Normal file
19
tools/arch/i586.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel Asm */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#define arch_plugin arch_plugin_i586
|
||||
#include "../src/arch/i586.c"
|
19
tools/arch/i686.c
Normal file
19
tools/arch/i686.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel Asm */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#define arch_plugin arch_plugin_i686
|
||||
#include "../src/arch/i686.c"
|
|
@ -6,7 +6,7 @@ dist=Makefile
|
|||
|
||||
[libasm]
|
||||
type=library
|
||||
sources=arch.c,format.c
|
||||
sources=arch.c,arch/arm.c,arch/armeb.c,arch/armel.c,arch/i386.c,arch/i486.c,arch/i586.c,arch/i686.c,format.c
|
||||
ldflags=../src/asm.o ../src/code.o ../src/parser.o ../src/token.o `pkg-config --libs cpp`
|
||||
|
||||
[arch.c]
|
||||
|
|
Loading…
Reference in New Issue
Block a user