[PATCH][ld] Put ".ctor*" and ".dtor*" to ".rdata".

Igor Kudrin ikudrin@accesssoftek.com
Wed Dec 7 15:43:00 GMT 2016


Hi,

The patch moves ".ctor*" and ".dtor*" input sections from ".text"
output section to ".rdata". As a result, the linker don't add
IMAGE_SCN_CNT_INITIALIZED_DATA flag to ".text" section and don't add
the size of the code section to field SizeOfInitializedData of
COFF Optional Header.

I've checked the generated executable images and dynamic libraries on
my environment and found no problems. I believe that there should not
be any issues because MS tools do the similar things.

Note: this patch requires https://sourceware.org/ml/binutils/2016-12/msg00119.html
to work, otherwise, some tests will fail.

Best regards,
Igor Kudrin

---
ld/ChangeLog

	scripttempl/pe.sc: Move .ctors* and .dtors* to .rdata section.
	scripttempl/pep.sc: Likewise.
	testsuite/ld-pe/longsecn.s: Remove DATA flag from
	.text.very.long.section.name section.
	testsuite/ld-pe/longsecn-1.d: Adjust the testcase.
	testsuite/ld-pe/longsecn-2.d: Likewise.
	testsuite/ld-pe/longsecn-3.d: Likewise.
	testsuite/ld-pe/longsecn-4.d: Likewise.
	testsuite/ld-pe/longsecn-5.d: Likewise.
	testsuite/ld-pe/longsecn.d: Likewise.
	testsuite/ld-pe/orphan.d: Likewise.
	testsuite/ld-pe/orphan_nu.d: Likewise.
	testsuite/ld-pe/secrel.d: Likewise.
	testsuite/ld-pe/secrel_64.d: Likewise.
	testsuite/ld-pe/tlssec64.d: Likewise.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ld-move-ctors-to-rdata.patch.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20161207/fa10eef8/attachment.txt>


More information about the Binutils mailing list