aboutsummaryrefslogtreecommitdiff
path: root/tccrun.c
diff options
context:
space:
mode:
authorgrischka <grischka>2012-09-01 11:33:34 +0200
committergrischka <grischka>2012-09-01 11:33:34 +0200
commitca38792df17fc5c8d2bb6757c512101610420f1e (patch)
tree2c9c6f33dee69bfadeafe0613c048f2f6cde2dd3 /tccrun.c
parent56e23984b9cd3b58e1766748524e63f8301ccd68 (diff)
downloadtinycc-ca38792df17fc5c8d2bb6757c512101610420f1e.tar.gz
tinycc-ca38792df17fc5c8d2bb6757c512101610420f1e.tar.bz2
tccrun: another incompatible change to the tcc_relocate API
We are now compatible with the 0.9,25 version though. A special value for the second (ptr) argument is used to get the simple behavior as with the 0.9.24 version.
Diffstat (limited to 'tccrun.c')
-rw-r--r--tccrun.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tccrun.c b/tccrun.c
index 41081cc..531f46a 100644
--- a/tccrun.c
+++ b/tccrun.c
@@ -47,9 +47,13 @@ static void win64_add_function_table(TCCState *s1);
/* Do all relocations (needed before using tcc_get_symbol())
Returns -1 on error. */
-LIBTCCAPI int tcc_relocate(TCCState *s1)
+LIBTCCAPI int tcc_relocate(TCCState *s1, void *ptr)
{
int ret;
+
+ if (TCC_RELOCATE_AUTO != ptr)
+ return tcc_relocate_ex(s1, ptr);
+
#ifdef HAVE_SELINUX
/* Use mmap instead of malloc for Selinux
Ref http://www.gnu.org/s/libc/manual/html_node/File-Size.html */
@@ -87,7 +91,7 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv)
int (*prog_main)(int, char **);
int ret;
- if (tcc_relocate(s1) < 0)
+ if (tcc_relocate(s1, TCC_RELOCATE_AUTO) < 0)
return -1;
prog_main = tcc_get_symbol_err(s1, "main");