tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] RUNTIME_PLTGOT question


From: Thomas Stalder
Subject: [Tinycc-devel] RUNTIME_PLTGOT question
Date: Mon, 7 Nov 2016 11:02:23 +0100

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/6a947d9d2610723db3f46bcae4f35d5d5c572f89


Can someone can explain me why PLTGOT has been removed or how can I compile my application in order to disable PLTGOT.

My sample code :

    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

reply via email to

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