tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] libtcc not working properly on x86-64 targets


From: Michael Kuklinski
Subject: [Tinycc-devel] libtcc not working properly on x86-64 targets
Date: Sun, 20 Dec 2009 18:28:14 -0600

When I attempt to use libtcc on 64-bit targets, and I push a symbol to a function defined in my program, It seems as though only 32-bits of the address of the function are being used.

 

void print (const char *str)

{

      printf(str);

}

 

int main ()

{

      TCCState *compile_state = tcc_new();

      const char * program =

            "                                                     \

            int main()                                      \

            {                                                     \

                  print(\"hello, world\");            \

                  return 0;                                 \

            }                                                     \

            ";

      int error = tcc_compile_string(compile_state, program);

      void *test = (void*)print;

      int r = tcc_add_symbol(compile_state, "print", (void*)print);

      tcc_set_output_type(compile_state, TCC_OUTPUT_MEMORY);

      tcc_run(compile_state, 0, 0);

      return 0;

}

 

Such works on 32-bit targets, but not 64, as it chops off all bits past 32.

 

I have tried this on both the master version release as well as the latest release on your CVS. Not sure where the chopping is occuring as the code is somewhat of a mess.

 

-Michael


reply via email to

[Prev in Thread] Current Thread [Next in Thread]