This is the mail archive of the binutils@sources.redhat.com 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] Fix strip bug with SHF_MERGE sections


Hi!

strip seemed to clear sh_entsize of SHF_MERGE sections, which means stripped
.o files couldn't be SHF_MERGE optimized.
Fixed thusly, ok to commit?

2001-12-08  Jakub Jelinek  <jakub@redhat.com>

	* objcopy.c (setup_section): Copy entsize for SEC_MERGE sections.

--- binutils/objcopy.c.jj	Tue Oct  2 00:25:22 2001
+++ binutils/objcopy.c	Sun Dec  9 00:04:13 2001
@@ -1596,6 +1596,16 @@ setup_section (ibfd, isection, obfdarg)
 
   if (p != NULL && p->set_flags)
     flags = p->flags | (flags & SEC_HAS_CONTENTS);
+  if (flags & SEC_MERGE)
+    {
+      /* For SEC_MERGE sections, we must copy both flags
+	 and merge entity size.  */
+      if ((bfd_get_section_flags (ibfd, isection) & (SEC_MERGE | SEC_STRINGS))
+	  == (flags & (SEC_MERGE | SEC_STRINGS)))
+	osection->entsize = isection->entsize;
+      else
+	flags &= ~(SEC_MERGE | SEC_STRINGS);
+    }
   if (!bfd_set_section_flags (obfd, osection, flags))
     {
       err = _("flags");

	Jakub


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