Why ctor and dtor sections aren't read-only? also linker script question.

Mathieu Gervais (LMC) lmcmatg@lmc.ericsson.se
Wed Apr 12 11:29:00 GMT 2000


Hi,

 with gcc version 2.95.2 (19991024 (release)), when I compile a C++ file
under Solaris 2.6, the .ctor and .dtor sections aren't marked READ-ONLY.
Why is that? I though those sections contained *code* that you need to
execute to construct (destruct) some objects.
 
 Can I load them in a read-only memory? How would I do to set the
section readonly in the (GNU LD) linker script?(assuming I want to take
.o with non readonly section and produced a linked executable with the
equivalent .ctor and dtor marked readonly).

Bonus question : how do I get the default linker script of GNU ld for my
target? Is it compiled into the ld executable or is it somewhere else?

Thanks,

 *please reply also directly, I'm not on the list*


Mathieu


More information about the Gcc-help mailing list