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?

Thanks!
David

-- 
 "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
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to