This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] give .comment sections SHF_MERGE|SHF_STRINGS


On Fri, 2009-07-24 at 12:08 -0700, Roland McGrath wrote:
> The compiler-generated .ident strings linked together tend all to be the
> same, resulting in giant .comment sections with a duplicate string for each
> translation unit.  We have the technology.  We can make them smaller, faster,
> better than before.
> 
> This looks obviously trivial and safe.  But I can't be bothered to actually
> test it or anything.  Anyone inspired?

It only seems to work if I explicitly set the section entsize to 1.

Index: gas/config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.115
diff -u -r1.115 obj-elf.c
--- gas/config/obj-elf.c	23 Jul 2009 13:00:27 -0000	1.115
+++ gas/config/obj-elf.c	24 Jul 2009 22:19:20 -0000
@@ -1723,7 +1723,9 @@
       char *p;
       comment_section = subseg_new (".comment", 0);
       bfd_set_section_flags (stdoutput, comment_section,
-			     SEC_READONLY | SEC_HAS_CONTENTS);
+			     SEC_READONLY | SEC_HAS_CONTENTS
+			     | SEC_MERGE | SEC_STRINGS);
+      comment_section->entsize = 1;
       p = frag_more (1);
       *p = 0;
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]