This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hi,

When linking a PE image, LD adds flag IMAGE_SCN_CNT_INITIALIZED_DATA to the section ".text". The size of the section counts twice in the header, in both "SizeOfCode" and "SizeOfInitializedData" fields. All these look quite weird.

As I understand, this behavior comes from adding ".ctor*" and ".dtor*" input sections into the output ".text" section, as it stated in "ld/scripttempl/pep.sc". I tried to move those statements into a ".rdata" section and, at the first glance, the resulting image worked as expected.

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?

Best regards,
Igor Kudrin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]