This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Fix strip bug with SHF_MERGE sections
- From: Jakub Jelinek <jakub at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Sat, 8 Dec 2001 22:59:49 +0100
- Subject: [PATCH] Fix strip bug with SHF_MERGE sections
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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