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]

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


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.

Attachment: ld-move-ctors-to-rdata.patch.txt
Description: ld-move-ctors-to-rdata.patch.txt


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