RPA Toolkit
Added support for ARM architecture.
authorMartin Stoilov <martin@rpasearch.com>
Wed, 10 Oct 2012 03:45:57 +0000 (20:45 -0700)
committerMartin Stoilov <martin@rpasearch.com>
Wed, 10 Oct 2012 03:45:57 +0000 (20:45 -0700)
17 files changed:
arch/unix/arm/rtypes.h [new file with mode: 0644]
build/unix/arm/Makefile [new file with mode: 0644]
build/unix/config.mk
rex/build/unix/arm/Makefile [new file with mode: 0644]
rexcc/build/unix/arm/Makefile [new file with mode: 0644]
rexgrep/build/unix/arm/Makefile [new file with mode: 0644]
rjs/build/unix/arm/Makefile [new file with mode: 0644]
rjs/build/unix/rjs.mk
rlib/build/unix/arm/Makefile [new file with mode: 0644]
rpa/build/unix/arm/Makefile [new file with mode: 0644]
rpagrep/build/unix/arm/Makefile [new file with mode: 0644]
rvm/build/unix/arm/Makefile [new file with mode: 0644]
tests/testmisc/build/unix/arm/Makefile [new file with mode: 0644]
tests/testrex/build/unix/arm/Makefile [new file with mode: 0644]
tests/testrex/build/unix/testrex.mk
tests/testrjs/build/unix/arm/Makefile [new file with mode: 0644]
tests/testrpa/build/unix/arm/Makefile [new file with mode: 0644]

diff --git a/arch/unix/arm/rtypes.h b/arch/unix/arm/rtypes.h
new file mode 100644 (file)
index 0000000..d417a45
--- /dev/null
@@ -0,0 +1,78 @@
+#ifndef _RTYPES_H_
+#define _RTYPES_H_
+
+/* 
+ * Architecture dependent types. These types have to be redefined
+ * for every architecture
+ */
+typedef signed char rint8;
+typedef unsigned char ruint8;
+typedef signed short rint16;
+typedef unsigned short ruint16;
+typedef signed int rint32;
+typedef unsigned int ruint32;
+typedef signed long long rint64;
+typedef unsigned long long ruint64;
+typedef unsigned int ratomic_t;
+typedef unsigned long ruword;
+typedef long rword;
+
+
+/*
+ * Common types. These types should be the same for most of the architectures.
+ */
+typedef int rboolean;
+typedef void *rpointer;
+typedef const void *rconstpointer;
+typedef struct {ruint32 p1; ruint32 p2;} rpair_t;
+
+/*
+ * Atomic operations (Architecture Dependent)
+ */
+#define R_ATOMIC_CMPXCHG(ptr, oldval, newval, resptr) \
+       do {*resptr = __sync_val_compare_and_swap(ptr, oldval, newval); } while (0)
+
+#define R_ATOMIC_XCHG(ptr, val) \
+       do {val = __sync_lock_test_and_set(ptr, val); } while (0)
+
+#define R_ATOMIC_ADD(ptr, val) \
+       do { __sync_fetch_and_add(ptr, val); } while (0)
+
+#define R_ATOMIC_SUB(ptr, val) \
+       do { __sync_fetch_and_sub(ptr, val); } while (0)
+
+
+
+#define R_DEBUG_BRAKE __asm__ ("")
+#define R_ASSERT(__a__) do {if (!(__a__)) R_DEBUG_BRAKE; } while (0)
+#define R_SIZE_ALIGN(s, n) ((((s) + (n) - 1) / (n)) * (n))
+#define R_MIN(a, b) ((a) < (b) ? (a): (b))
+#define R_MAX(a, b) ((a) > (b) ? (a): (b))
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((rpointer)0)
+#endif
+#endif
+
+#ifndef TRUE
+#define TRUE ((rboolean)1)
+#endif
+
+#ifndef FALSE
+#define FALSE ((rboolean)0)
+#endif
+
+
+typedef enum {
+       RVALSET_NONE = 0,
+       RVALSET_OR,
+       RVALSET_XOR,
+       RVALSET_AND,
+} rvalset_t;
+
+
+#endif
+
diff --git a/build/unix/arm/Makefile b/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..3608ebc
--- /dev/null
@@ -0,0 +1,2 @@
+include ../x86_64/Makefile
+
index 82e02be..055f8c6 100644 (file)
@@ -3,8 +3,22 @@ RPATK_INC_INSTALL=/usr/include/rpatk
 ARCHDIR = $(shell basename $(shell pwd))
 OS = $(shell uname | tr "[:upper:]" "[:lower:]")
 
+ifndef CC
 CC = gcc
+endif
+
+ifndef LD
 LD = ld
+endif
+
+ifndef AR
 AR = ar
+endif
+
+ifndef CPP
 CPP = g++
-OC = objcopy
+endif
+
+ifndef OBJCOPY
+OBJCOPY = objcopy
+endif
diff --git a/rex/build/unix/arm/Makefile b/rex/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..5a3df57
--- /dev/null
@@ -0,0 +1,22 @@
+ROOT_DIR = ../../../..
+include $(ROOT_DIR)/build/unix/config.mk
+
+INCLUDE = -I$(ROOT_DIR)/arch/unix/$(ARCHDIR)
+OUTDIR = out
+
+
+CFLAGS := $(MACH)
+ifeq ($(BLDCFG), release)
+CFLAGS += -fPIC -O2
+else
+CFLAGS += -fPIC -O0 -g -Wall
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(INCLUDE)
+LDFLAGS := $(MACH)
+
+include ../rex.mk
diff --git a/rexcc/build/unix/arm/Makefile b/rexcc/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..fef535c
--- /dev/null
@@ -0,0 +1,27 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+ROOT_DIR = ../../../..
+
+include $(ROOT_DIR)/build/unix/config.mk
+
+CFLAGS = $(MACH)
+ifeq ($(BLDCFG), release)
+CFLAGS += -O2
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS += -O0 -pg
+else
+CFLAGS += -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(INCLUDE)
+LDFLAGS = $(MACH)
+
+
+include ../rexcc.mk
diff --git a/rexgrep/build/unix/arm/Makefile b/rexgrep/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..e2b6f28
--- /dev/null
@@ -0,0 +1,27 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+ROOT_DIR = ../../../..
+
+include $(ROOT_DIR)/build/unix/config.mk
+
+CFLAGS = $(MACH)
+ifeq ($(BLDCFG), release)
+CFLAGS += -O2
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS += -O0 -pg
+else
+CFLAGS += -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(INCLUDE)
+LDFLAGS = $(MACH)
+
+
+include ../rexgrep.mk
diff --git a/rjs/build/unix/arm/Makefile b/rjs/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..12b04b3
--- /dev/null
@@ -0,0 +1,26 @@
+ROOT_DIR = ../../../..
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+INCLUDE = -I$(ROOT_DIR)/arch/unix/$(ARCHDIR)
+ELFARCH = elf32-littlearm
+BINARCH = arm
+OCFLAGS_TXT = --input binary --output $(ELFARCH) --binary-architecture $(BINARCH)
+
+include $(ROOT_DIR)/build/unix/config.mk
+
+ifeq ($(BLDCFG), release)
+CFLAGS := $(MACH) -fPIC -O2
+else
+CFLAGS := $(MACH) -fPIC -O0 -g -Wall 
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(INCLUDE)
+LDFLAGS := $(MACH)
+
+
+include ../rjs.mk
index 0e7b2af..f3ab9fd 100644 (file)
@@ -92,7 +92,7 @@ $(RJS_SO): $(RJS_OBJECTS)
        $(CC) $(LDFLAGS) -shared -Wl,-soname,librjs.so -o $@ $^
 
 $(OUTDIR)/%.o: $(RJS_SRCDIR)/%.rpa
-       $(OC) $(OCFLAGS_TXT)  $(RJS_SRCDIR)/$*.rpa $(OUTDIR)/$*.o
+       $(OBJCOPY) $(OCFLAGS_TXT)  $(RJS_SRCDIR)/$*.rpa $(OUTDIR)/$*.o
 
 $(OUTDIR):
        @mkdir $(OUTDIR)
diff --git a/rlib/build/unix/arm/Makefile b/rlib/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..a34509b
--- /dev/null
@@ -0,0 +1,28 @@
+ROOT_DIR = ../../../..
+include $(ROOT_DIR)/build/unix/config.mk
+
+INCLUDE = -I$(ROOT_DIR)/arch/unix/$(ARCHDIR)
+OUTDIR = out
+
+CFLAGS := $(MACH)
+ifeq ($(BLDCFG), release)
+CFLAGS += -fPIC -O2
+else 
+ifeq ($(BLDCFG), profile)
+CFLAGS += -fPIC -O0 -pg -Wall
+CFLAGS += -DR_DEBUG_MEMALLOC
+else
+CFLAGS += -fPIC -O0 -g -Wall
+CFLAGS += -DR_DEBUG_MEMALLOC
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS +=  $(INCLUDE)
+LDFLAGS := $(MACH)
+
+
+include ../rlib.mk
diff --git a/rpa/build/unix/arm/Makefile b/rpa/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..3f2f043
--- /dev/null
@@ -0,0 +1,20 @@
+ROOT_DIR = ../../../..
+include $(ROOT_DIR)/build/unix/config.mk
+INCLUDE = -I$(ROOT_DIR)/arch/unix/$(ARCHDIR)
+OUTDIR = out
+
+CFLAGS := $(MACH)
+ifeq ($(BLDCFG), release)
+CFLAGS += -fPIC -O2
+else
+CFLAGS += -fPIC -O0 -g -Wall 
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(INCLUDE)
+LDFLAGS := $(MACH)
+
+include ../rpa.mk
diff --git a/rpagrep/build/unix/arm/Makefile b/rpagrep/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..a1a5504
--- /dev/null
@@ -0,0 +1,27 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+ROOT_DIR = ../../../..
+
+include $(ROOT_DIR)/build/unix/config.mk
+
+CFLAGS = $(MACH)
+ifeq ($(BLDCFG), release)
+CFLAGS += -O2
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS += -O0 -pg
+else
+CFLAGS += -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(INCLUDE)
+LDFLAGS = $(MACH)
+
+
+include ../rgrep.mk
diff --git a/rvm/build/unix/arm/Makefile b/rvm/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..7869afe
--- /dev/null
@@ -0,0 +1,26 @@
+ROOT_DIR = ../../../..
+include $(ROOT_DIR)/build/unix/config.mk
+
+INCLUDE = -I$(ROOT_DIR)/arch/unix/$(ARCHDIR)
+OUTDIR = out
+
+CFLAGS += $(MACH)
+ifeq ($(BLDCFG), release)
+CFLAGS += -fPIC -O2
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS += -fPIC -O0 -pg -Wall 
+else
+CFLAGS += -fPIC -O0 -g -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+
+CFLAGS += $(INCLUDE)
+LDFLAGS := $(MACH)
+
+include ../rvm.mk
diff --git a/tests/testmisc/build/unix/arm/Makefile b/tests/testmisc/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..946c1ca
--- /dev/null
@@ -0,0 +1,28 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+ROOT_DIR = ../../../../..
+
+include $(ROOT_DIR)/build/unix/config.mk
+
+ifeq ($(BLDCFG), release)
+CFLAGS = -O2
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../misc-tests.mk
diff --git a/tests/testrex/build/unix/arm/Makefile b/tests/testrex/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..8e37e1d
--- /dev/null
@@ -0,0 +1,28 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+ROOT_DIR = ../../../../..
+
+include $(ROOT_DIR)/build/unix/config.mk
+
+ifeq ($(BLDCFG), release)
+CFLAGS = -O2
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../testrex.mk
index 7b52a4d..576138a 100644 (file)
@@ -18,7 +18,7 @@ all : $(OUTDIR) $(TESTS)
 
 
 $(OUTDIR)/%: $(TESTS_SRCDIR)/%.c
-       + $(CC) $(CFLAGS) -o $(OUTDIR)/$* $(TESTS_SRCDIR)/$*.c  -lrpa $(LIBS) $(LDFLAGS) $(INCLUDE)
+       + $(CC) $(CFLAGS) -o $(OUTDIR)/$* $(TESTS_SRCDIR)/$*.c  -lrex $(LIBS) $(LDFLAGS) $(INCLUDE)
 
 
 $(OUTDIR)/%.o: $(TESTS_SRCDIR)/%.rpa
diff --git a/tests/testrjs/build/unix/arm/Makefile b/tests/testrjs/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..19a3a69
--- /dev/null
@@ -0,0 +1,28 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+ROOT_DIR = ../../../../..
+
+include $(ROOT_DIR)/build/unix/config.mk
+
+ifeq ($(BLDCFG), release)
+CFLAGS = -O2
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../testrjs.mk
diff --git a/tests/testrpa/build/unix/arm/Makefile b/tests/testrpa/build/unix/arm/Makefile
new file mode 100644 (file)
index 0000000..c9a8715
--- /dev/null
@@ -0,0 +1,28 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+ROOT_DIR = ../../../../..
+
+include $(ROOT_DIR)/build/unix/config.mk
+
+ifeq ($(BLDCFG), release)
+CFLAGS = -O2
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../testrpa2.mk