COFF compressed debug support

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.
This commit is contained in:
Alan Modra
2022-11-17 07:58:31 +10:30
parent 13917d936e
commit 2fa250529b

View File

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