public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: COFF compressed debug support
Date: Mon, 5 Dec 2022 08:21:56 +1030	[thread overview]
Message-ID: <Y40WfJl0V9ifv+fN@squeak.grove.modra.org> (raw)


Since commit 4bea06d73c04 COFF support for compressed debug sections
has been broken due to the "flags" variable not getting SEC_HAS_CONTENTS.

	* coffgen.c (make_a_section_from_file): Correct section flags
	handling.  Delete extraneous condition.  Update error messages
	to be the same as in elf.c.

diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index f2c71b19880..e072e168cb8 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -131,18 +131,18 @@ make_a_section_from_file (bfd *abfd,
 					 & flags))
     result = false;
 
-  return_section->flags = flags;
-
   /* At least on i386-coff, the line number count for a shared library
      section must be ignored.  */
-  if ((return_section->flags & SEC_COFF_SHARED_LIBRARY) != 0)
+  if ((flags & SEC_COFF_SHARED_LIBRARY) != 0)
     return_section->lineno_count = 0;
 
   if (hdr->s_nreloc != 0)
-    return_section->flags |= SEC_RELOC;
+    flags |= SEC_RELOC;
   /* FIXME: should this check 'hdr->s_size > 0'.  */
   if (hdr->s_scnptr != 0)
-    return_section->flags |= SEC_HAS_CONTENTS;
+    flags |= SEC_HAS_CONTENTS;
+
+  return_section->flags = flags;
 
   /* Compress/decompress DWARF debug sections with names: .debug_* and
      .zdebug_*, after the section flags is set.  */
@@ -161,7 +161,7 @@ make_a_section_from_file (bfd *abfd,
 	  if ((abfd->flags & BFD_DECOMPRESS))
 	    action = decompress;
 	}
-      else if (!bfd_is_section_compressed (abfd, return_section))
+      else
 	{
 	  /* Normal section.  Check if we should compress.  */
 	  if ((abfd->flags & BFD_COMPRESS) && return_section->size != 0)
@@ -177,7 +177,7 @@ make_a_section_from_file (bfd *abfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext: c-format */
-		(_("%pB: unable to initialize compress status for section %s"),
+		(_("%pB: unable to compress section %s"),
 		 abfd, name);
 	      return false;
 	    }
@@ -194,7 +194,7 @@ make_a_section_from_file (bfd *abfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext: c-format */
-		(_("%pB: unable to initialize decompress status for section %s"),
+		(_("%pB: unable to decompress section %s"),
 		 abfd, name);
 	      return false;
 	    }
-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2022-12-04 21:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y40WfJl0V9ifv+fN@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).