This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch bfd]: Add support for additional linked-once duplicated section kinds for pe-coff targets
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Tue, 27 Sep 2011 14:39:33 +0200
- Subject: [patch bfd]: Add support for additional linked-once duplicated section kinds for pe-coff targets
Hi,
this patch add support for some more comdat variants for section linking of
duplicates, which are already handled within comdat-handler.
ChangeLog
2011-09-27 Kai Tietz <ktietz@redhat.com>
* coffcode.h (sec_to_styp_flags): Handle
SEC_LINK_DUPLICATES_SAME_CONTENTS, and
SEC_LINK_DUPLICATES_SAME_SIZE.
Regression tested for x86_64-w64-mingw32, i686-w64-mingw32, and i686-pc-cygwin.
Ok for apply?
Regards,
Kai
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.181
diff -u -r1.181 coffcode.h
--- bfd/coffcode.h 17 Aug 2011 00:39:38 -0000 1.181
+++ bfd/coffcode.h 27 Sep 2011 11:21:46 -0000
@@ -670,7 +670,9 @@
/* FIXME: There is no gas syntax to specify the debug section flag. */
if (is_dbg)
{
- sec_flags &= (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD);
+ sec_flags &= (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
+ | SEC_LINK_DUPLICATES_SAME_CONTENTS
+ | SEC_LINK_DUPLICATES_SAME_SIZE);
sec_flags |= SEC_DEBUGGING | SEC_READONLY;
}
@@ -698,7 +700,11 @@
/* skip SORT */
if (sec_flags & SEC_LINK_ONCE)
styp_flags |= IMAGE_SCN_LNK_COMDAT;
- /* skip LINK_DUPLICATES */
+ if ((sec_flags
+ & (SEC_LINK_DUPLICATES_DISCARD | SEC_LINK_DUPLICATES_SAME_CONTENTS
+ | SEC_LINK_DUPLICATES_SAME_SIZE)) != 0)
+ styp_flags |= IMAGE_SCN_LNK_COMDAT;
+
/* skip LINKER_CREATED */
if ((sec_flags & SEC_COFF_NOREAD) == 0)