tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] symtab_section


From: grischka
Subject: Re: [Tinycc-devel] symtab_section
Date: Wed, 18 Apr 2012 18:50:48 +0200
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

I pushed a small patch that should allow using tcc_get_symbol also
for older states. Please test.

http://repo.or.cz/w/tinycc.git/commitdiff/f98c2306a0857ad3f8800f91e0554a27adc7f675

Current state of multiple TCCStates usage summary:

There are now two things you can do with TCCStates after tcc_relocate:
  - run the ccde
  - get symbol addresses

There is one thing you cannot do _before_ tcc_relocate:
  - create another TCCState

Also, tcc_relocate can be called only once for each state.

--- grischka

David Mertens wrote:
Milutin, all -

Yes, you were absolutely correct. Once I recompiled tcc as a shared library, the issue went away. That lesson has been learned. :-)

However, my main question remains unanswered, and my suspicions have been confirmed with new tests. To recap, here is my original question:

    Is there a good reason symtab_section is a global variable? In
    addition to the issue that I encountered, what if I want to have
    multiple compiler states? It looks to me like the pointer for
    symtab_section will be overwritten for each call to the constructor.
    Won't this lead to trouble? And is there any reason we don't have a
    field in the TCCState struct to store the location of symtab_section?


Whether or not this is the source, I have indeed encountered issues under a few circumstances:

1) Using a single compiler state, compiling+relocating multiple times. When I do this, I cannot call any functions from the first relocation after the second relocation. 2) Using two states, I cannot call any functions from the first state after I have compiled+relocated the second state. Using the *first* state, I *can* retrieve symbols from the compilation of the second state!

So, it looks like there's a global variable for some sort of symbol table machinations.

Thoughts?
David





reply via email to

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