This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Patch - setting SHT_NOBITS
- To: binutils at sourceware dot cygnus dot com
- Subject: Patch - setting SHT_NOBITS
- From: Momchil Velikov <velco at fadata dot bg>
- Date: 28 Sep 2000 21:22:54 +0300
Hi,
The following patch prevents the BFD from setting the type of a
section to SHT_NOBITS if the section is marked to SEC_HAS_CONTENTS.
Otherwise, no space is allocated for the section in the output file,
but it still can be output (e.g. in case of bfd_fill_link_order), thus
corrupting the output file.
Regards,
-velco
2000-09-28 Momchil Velikov <velco@fadata.bg>
* elf.c (elf_fake_sections): Do not mark the section SHT_NOBITS if
is has the SEC_HAS_CONTENTS flags set.
--- bfd/elf.c.orig Thu Sep 28 21:02:59 2000
+++ bfd/elf.c Thu Sep 28 21:03:44 2000
@@ -1790,7 +1790,7 @@
&& (asect->flags & SEC_LOAD) != 0)
this_hdr->sh_type = SHT_PROGBITS;
else if ((asect->flags & SEC_ALLOC) != 0
- && ((asect->flags & SEC_LOAD) == 0))
+ && ((asect->flags & (SEC_LOAD|SEC_HAS_CONTENTS)) == 0))
this_hdr->sh_type = SHT_NOBITS;
else
{