|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Let's suppose that, under a particular platform,
the compiler doesn't initialize correctly the global constructors and destructors at startup. The compiler is psp-gcc. I have written two routines, __do_constructor_initialization_aux and __do_destructor_initialization_aux that, if recalled explictly by the code of the program, start the routines generated by the compiler and initialize the global constructors (o deinitialize the constructors when the program finish). Unfortunately, each of this routine can access only to the .ctor or .dtor section of the module in which it is compiled, not to the .ctor or .dtor section of different modules. So, if you are compiling a project in C++ that contains n files .o, **in each of these** a routine __do_constructor_initialization_aux and a routine __do_destructor_initialization_aux must be present. If the project has n object .o, there will be n __do_constructor_initialization_aux routines and n __do_destructor_initialization_aux routines. N isn't a known number, because it depends from the o. files that the programmer chooses to create. The trouble is the following: who start these routines at startup ? It is needed a special symbol in psp-gcc or in psp-ld that makes that, at startup, before that main () is executed, the cpu executes all initialitation routines present in each module that has been linked. Any idea ? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Pegasus wrote:
> Let's suppose that, under a particular platform, > the compiler doesn't initialize correctly the > global constructors and destructors at > startup. Not sure what you mean by "initialize correctly the global constructors". Constructors are functions, what's there to initialise, correctly or otherwise? > The compiler is psp-gcc. > [... something about routines to be called at startup and exit ...] > > The trouble is the following: who start these > routines at startup ? <shrug> There is *no mechanism* in the /Standard C++/ to call anything at startup *except* by means of the constructor of a global object. If those don't work, you're in the implementation-specific territory and you need to post your question to the newsgroup/forum dedicated to the compiler of your choice. > It is needed a special symbol in psp-gcc or in > psp-ld that makes that, at startup, before that > main () is executed, the cpu executes all > initialitation routines present in each module > that has been linked. > > Any idea ? Well, not really. It's off-topic. V -- Please remove capital 'A's when replying by e-mail I do not respond to top-posted replies, please don't ask |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Jun 3, 1:45 pm, "Pegasus" <non...@nowhere.com> wrote:
> Let's suppose that, under a particular platform, > the compiler doesn't initialize correctly the > global constructors and destructors at > startup. > > The compiler is psp-gcc. > > I have written two routines, > > __do_constructor_initialization_aux > > and > > __do_destructor_initialization_aux In general, if you are doing something really weird like this, then you are also doing something really wrong. A quick Google search for "psp-gcc __do_constructor_initialization_aux" yields no results. A slightly less quick Google search for psp-gcc and problems related to broken static initialization yielded no relevant results. Are you sure that this is a psp-gcc related problem? Buggy static initialization with the psp-gcc compiler seems to me like it would be a more widely-known problem with more information. Since you seem to be one of a handful, if not the only person, suffering from whatever problem this is, you should double-check to make sure you aren't doing something weird somewhere else. |
|
![]() |
| Outils de la discussion | |
|
|