summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@ginger.bigkitten.com>2008-05-29 13:49:04 -0700
committerDavid Schleef <ds@ginger.bigkitten.com>2008-05-29 13:49:04 -0700
commitab5b03acfb40d446e4934e49a0f38bb02137468d (patch)
treedb8d0751f3f19da9adc05e1ea49b4880503fe550
parenta60fdaca134c28fb774993f3f2555fd6afbb1352 (diff)
downloadliboil-ab5b03acfb40d446e4934e49a0f38bb02137468d.tar.gz
[orc] Fixes for compiling for windows
-rw-r--r--orc/Makefile.am13
-rw-r--r--orc/orc.c2
-rw-r--r--orc/orcprogram-powerpc.c1
-rw-r--r--orc/orcprogram-unknown-os.c58
-rw-r--r--orc/orcprogram-x86.c1
-rw-r--r--orc/orcprogram.h1
-rw-r--r--orc/orcrules-mmx.c1
-rw-r--r--orc/orcrules-sse.c1
-rw-r--r--orc/orcrules-x86.c1
-rw-r--r--orc/x86.c1
10 files changed, 72 insertions, 8 deletions
diff --git a/orc/Makefile.am b/orc/Makefile.am
index bb0d56e..b46eaac 100644
--- a/orc/Makefile.am
+++ b/orc/Makefile.am
@@ -5,6 +5,11 @@ lib_LTLIBRARIES = liborc-@LIBOIL_MAJORMINOR@.la
liborc_@LIBOIL_MAJORMINOR@_la_LIBS = $(LIBOIL_LIBS) $(GLIB_LIBS)
liborc_@LIBOIL_MAJORMINOR@_la_CFLAGS = $(LIBOIL_CFLAGS) $(GLIB_CFLAGS)
+liborc_@LIBOIL_MAJORMINOR@_la_LDFLAGS = \
+ -no-undefined \
+ -version-info $(LIBOIL_LIBVERSION) \
+ -export-symbols-regex '^orc_'
+
liborc_@LIBOIL_MAJORMINOR@_la_SOURCES = \
orc.c \
@@ -17,12 +22,18 @@ liborc_@LIBOIL_MAJORMINOR@_la_SOURCES = \
orcprogram-powerpc.c \
orcprogram.h \
orcopcodes.c \
- orcprogram-linux.c \
orcrules-mmx.c \
orcrules-x86.c \
orcrules-sse.c \
x86.c
+if HAVE_OS_LINUX
+liborc_@LIBOIL_MAJORMINOR@_la_SOURCES += orcprogram-linux.c
+else
+liborc_@LIBOIL_MAJORMINOR@_la_SOURCES += orcprogram-unknown-os.c
+endif
+
+
pkginclude_HEADERS = \
orc.h \
orcprogram.h \
diff --git a/orc/orc.c b/orc/orc.c
index 6094adb..27b4d35 100644
--- a/orc/orc.c
+++ b/orc/orc.c
@@ -12,7 +12,7 @@
void
orc_init (void)
{
- oil_init ();
+ //oil_init ();
orc_opcode_init();
orc_x86_init();
orc_powerpc_init();
diff --git a/orc/orcprogram-powerpc.c b/orc/orcprogram-powerpc.c
index 543b95b..131f594 100644
--- a/orc/orcprogram-powerpc.c
+++ b/orc/orcprogram-powerpc.c
@@ -7,7 +7,6 @@
#include <unistd.h>
#include <sys/types.h>
-#include <sys/mman.h>
#include <orc/orcprogram.h>
diff --git a/orc/orcprogram-unknown-os.c b/orc/orcprogram-unknown-os.c
new file mode 100644
index 0000000..130fc34
--- /dev/null
+++ b/orc/orcprogram-unknown-os.c
@@ -0,0 +1,58 @@
+
+#include "config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <unistd.h>
+#include <sys/types.h>
+#if 0
+#include <sys/mman.h>
+#endif
+
+#include <orc/orcprogram.h>
+
+#define SIZE 65536
+
+
+void
+orc_program_allocate_codemem (OrcProgram *program)
+{
+#if 0
+ char filename[32] = "/tmp/orcexecXXXXXX";
+ int fd;
+
+ fd = mkstemp (filename);
+ if (fd == -1) {
+ /* FIXME oh crap */
+ printf("failed to create temp file\n");
+ program->error = TRUE;
+ return;
+ }
+ unlink (filename);
+
+ ftruncate (fd, SIZE);
+
+ program->code = mmap (NULL, SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+ if (program->code == MAP_FAILED) {
+ /* FIXME oh crap */
+ printf("failed to create write map\n");
+ program->error = TRUE;
+ return;
+ }
+ program->code_exec = mmap (NULL, SIZE, PROT_READ|PROT_EXEC, MAP_SHARED, fd, 0);
+ if (program->code_exec == MAP_FAILED) {
+ /* FIXME oh crap */
+ printf("failed to create exec map\n");
+ program->error = TRUE;
+ return;
+ }
+
+ close (fd);
+
+ program->code_size = SIZE;
+ program->codeptr = program->code;
+#endif
+}
+
diff --git a/orc/orcprogram-x86.c b/orc/orcprogram-x86.c
index ca70bb2..7308b7b 100644
--- a/orc/orcprogram-x86.c
+++ b/orc/orcprogram-x86.c
@@ -7,7 +7,6 @@
#include <unistd.h>
#include <sys/types.h>
-#include <sys/mman.h>
#include <orc/orcprogram.h>
#include <orc/x86.h>
diff --git a/orc/orcprogram.h b/orc/orcprogram.h
index 3281f0e..2dbacf4 100644
--- a/orc/orcprogram.h
+++ b/orc/orcprogram.h
@@ -3,6 +3,7 @@
#define _ORC_PROGRAM_H_
//#include <glib.h>
+#include <liboil/liboil-stdint.h>
typedef struct _OrcType OrcType;
typedef struct _OrcExecutor OrcExecutor;
diff --git a/orc/orcrules-mmx.c b/orc/orcrules-mmx.c
index 23248de..7ecadeb 100644
--- a/orc/orcrules-mmx.c
+++ b/orc/orcrules-mmx.c
@@ -7,7 +7,6 @@
#include <unistd.h>
#include <sys/types.h>
-#include <sys/mman.h>
#include <orc/orcprogram.h>
#include <orc/x86.h>
diff --git a/orc/orcrules-sse.c b/orc/orcrules-sse.c
index 9f559e0..155ac5f 100644
--- a/orc/orcrules-sse.c
+++ b/orc/orcrules-sse.c
@@ -7,7 +7,6 @@
#include <unistd.h>
#include <sys/types.h>
-#include <sys/mman.h>
#include <orc/orcprogram.h>
#include <orc/x86.h>
diff --git a/orc/orcrules-x86.c b/orc/orcrules-x86.c
index 4becb48..e2fbd73 100644
--- a/orc/orcrules-x86.c
+++ b/orc/orcrules-x86.c
@@ -7,7 +7,6 @@
#include <unistd.h>
#include <sys/types.h>
-#include <sys/mman.h>
#include <orc/orcprogram.h>
#include <orc/x86.h>
diff --git a/orc/x86.c b/orc/x86.c
index 55de4b3..aaf09c1 100644
--- a/orc/x86.c
+++ b/orc/x86.c
@@ -7,7 +7,6 @@
#include <unistd.h>
#include <sys/types.h>
-#include <sys/mman.h>
#include <orc/orcprogram.h>
#include <orc/x86.h>