Why GNU LD puts ".?tor*" sections into ".text" section when linking a PE image?

Nick Clifton nickc@redhat.com
Thu Dec 1 15:42:00 GMT 2016


Hi Igor,

> Can anybody explain, why ".ctor*" and ".dtor*" sections were added into a ".text" section? 
> Is it safe to move those statements to another place, like a ".rdata" section?

I can hazard a guess, but I cannot give you a definitive answer:

The reason I suspect is so that these sections contain function pointers
and so they should be considered to be part of the executable region of
the program.  This might be important on architectures which make a 
distinction between data and code fetches.

Cheers
  Nick



More information about the Binutils mailing list