about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm/tools/emul_lib/libcodenat_tcc.c2
-rw-r--r--miasm/tools/to_c_helper.py15
2 files changed, 15 insertions, 2 deletions
diff --git a/miasm/tools/emul_lib/libcodenat_tcc.c b/miasm/tools/emul_lib/libcodenat_tcc.c
index 36bd5d17..c9bc1187 100644
--- a/miasm/tools/emul_lib/libcodenat_tcc.c
+++ b/miasm/tools/emul_lib/libcodenat_tcc.c
@@ -109,7 +109,7 @@ PyObject* tcc_compil(PyObject* self, PyObject* args)
 		exit(0);
 	}
 	/* XXX use tinycc devel with -fPIC patch in makefile */
-	if (tcc_relocate(tcc_state, NULL) < 0)
+	if (tcc_relocate(tcc_state,TCC_RELOCATE_AUTO) < 0)
 		exit(0);
 	entry = tcc_get_symbol(tcc_state, func_name);
 	if (!entry){
diff --git a/miasm/tools/to_c_helper.py b/miasm/tools/to_c_helper.py
index bbfe9bde..284e2d83 100644
--- a/miasm/tools/to_c_helper.py
+++ b/miasm/tools/to_c_helper.py
@@ -1039,7 +1039,20 @@ def updt_bloc_emul(known_blocs, in_str, my_eip, symbol_pool, code_blocs_mem_rang
     """%(patch_c_id(eip), patch_c_id(eip), patch_c_id(eip), patch_c_id(eip), patch_c_id(eip))
 
     c_source = gen_C_source(funcs_code, {}, dyn_dispatcher)
-    c_source = "#include <Python.h>\n"+c_source
+
+    c_source = """
+#ifdef __x86_64__
+#ifndef __LP64__
+/*
+ for ubuntu ?!? XXX TODO
+ /!\ force 64 bit system using 64 bits libc
+ change this to __ILP32__ to do so.
+*/
+#define __LP64__
+#endif
+#endif
+""" + "#include <Python.h>\n" + c_source
+
     #c_source = '#include "emul_lib/libcodenat.h"\n'+c_source
     #print c_source
     a = gen_C_module_tcc(fname, c_source)