Hello,
I have try to integrate libtcc into my application to compile and execute c code on my Rpi3 with Raspbian. Libtcc and my application are compiled with gcc version 4.9.2 (Raspbian 4.9.2-10).
I have tested with TinyCC 0.9.26 and all works fine.
I have tested with latests TinyCC git commit and sometimes i have the error (with DEBUG_RELOC) :
reloc 1: x=0xfffffe val=0x1eddc newx=0xfdaf7d70 name=printf
tcc: error: can't relocate value at 2527064,1
The problem seem to be with commit
http://repo.or.cz/tinycc.git/commit/6a947d9d2610723db3f46bcae4f35d5d5c572f89Can someone can explain me why PLTGOT has been removed or how can I compile my application in order to disable PLTGOT.
s = tcc_new();
if (!s) {
fprintf(stderr, "Could not create tcc state\n");
exit(1);
}
/* MUST BE CALLED before any compilation */
tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
tcc_set_options(s, "-nostdlib");
if (tcc_compile_string(s, my_program) == -1)
return 1;
if (tcc_add_symbol(s, "printf", printf) == -1)
return 1;
if (tcc_add_symbol(s, "add", add) == -1)
return 1;
if (tcc_relocate(s, TCC_RELOCATE_AUTO) < 0)
return 1;
func = tcc_get_symbol(s, "foo");
if (!func)
return 1;
Thanks in advance.
Thomas