This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: egcc 1.1.2 outputs global object constructors as local (C static) symbols
>>>>> "Martin" == Martin v Loewis <martin@mira.isdn.cs.tu-berlin.de> writes:
Martin> I still think it is the wrong approach. i586-pc-linux-gnu (or whatever
Martin> Linux target you appear to use) is what C++ calls a 'hosted'
Martin> environment, whereas you seem to be targetting a 'freestanding'
Martin> environment. gcc is well-suited for freestanding environments, you
Martin> just have to define what its properties are.
eric>However, we would like to use the *same* compiler for compiling the
eric>system and applications. Think about having a compiler for linux kernel
eric>and another for applications... Is there a way to gracefully control
eric>"global initializer" instanciation?
Thinking a little bit more about the problem I have nothing against
GNU ld doing the work provided I have access to the ctors/dtors table
and the name of the global objects in addition to their address.
This would really solves the problem without requiring gcc modification
exported_symbol_ctor_table ctor_table {
{function_pointer, original_symbol_name},
...
{0, 0}
};
NB : the original_symbol_name may be REQUIRED to use proprietary
constructor ordering technic based on symbol name and would
remove the need of some GNU C++ extension like pragma for
ordering constructors...
-- eric