This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] give .comment sections SHF_MERGE|SHF_STRINGS
- From: Mark Wielaard <mjw at redhat dot com>
- To: Roland McGrath <roland at redhat dot com>
- Cc: binutils at sources dot redhat dot com, Andreas Schwab <schwab at redhat dot com>, Nick Clifton <nickc at redhat dot com>
- Date: Sat, 25 Jul 2009 00:23:26 +0200
- Subject: Re: [PATCH] give .comment sections SHF_MERGE|SHF_STRINGS
- References: <20090724190834.36DC23CCB@magilla.sf.frob.com>
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;
}