[Top][All Lists]

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

[Tinycc-devel] symtab_section

From: David Mertens
Subject: [Tinycc-devel] symtab_section
Date: Wed, 21 Mar 2012 09:53:29 -0500

Hello all -

I ran into and then solved a very weird error in which the symtab_section global variable is being set to some non-null value during the constructor phase of my compiler state, but is null when I actually try to add symbols! The reason is because the symbol addition occurred from a different .so file as the constructor, and these apparently did not share their global symtab_section global variable.

Obviously, my understanding of dynamic linking is weak, but bear with me, I have a sensible 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?


 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan

reply via email to

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