Unlike ELF, named sections such as .bss.* and .gnu.linkonce.b.* have no
special meaning in COFF, therefore they will have the CONTENTS and LOAD
attributes set.  The result is that these sections take up space in
object files and executables.  These attributes can be cleared by
emitting the "b" flag in the .section directive.

This can probably be added in default_coff_asm_named_section too.

gcc/
2020-03-25  Jan W. Jagersma  <jwjager...@gmail.com>

        * config/i386/djgpp.c (i386_djgpp_asm_named_section): Emit "b"
        flag for SECTION_BSS.
---
 gcc/config/i386/djgpp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/config/i386/djgpp.c b/gcc/config/i386/djgpp.c
index ba6c2d4d3a4..88cf1e6506e 100644
--- a/gcc/config/i386/djgpp.c
+++ b/gcc/config/i386/djgpp.c
@@ -36,6 +36,8 @@ i386_djgpp_asm_named_section(const char *name, unsigned int 
flags,
     *f++ = 'w';
   if (flags & SECTION_CODE)
     *f++ = 'x';
+  if (flags & SECTION_BSS)
+    *f++ = 'b';
 
   /* LTO sections need 1-byte alignment to avoid confusing the
      zlib decompression algorithm with trailing zero pad bytes.  */
-- 
2.25.2

Reply via email to