This is the mail archive of the binutils@sources.redhat.com 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]

Re: [PATCH] SHF_MERGE fixes


On Fri, Apr 20, 2001 at 05:32:38PM +0200, Jakub Jelinek wrote:
> Hi!
> 
> I've implemented today gcc support for SHF_MERGE and while testing it, I
> found one real bug in merge.c (it was not searching hash table properly
> if two strings had the same hash) plus one inefficiency:
> if in a SHF_STRINGS section some strings are with smaller and some with
> bigger alignment, then the optimization made things actually worse, because
> e.g. for:
> 
> 	.section .rodata.str1, "ams", @progbits, 1
> .LC0:	.string "foo"
> .LC1:	.string "bar"
> 	.align 32
> .LC2:	.string "StringLongerThanThirtyTwoBytesSoThatia32BackendAlignsItTo128Bits"
> 
> it would try to align every string to 32bytes.
> The patch below changes alignment to be a per-string (or per-constant)
> thing, so the results are far better in this case and it should be never
> worse than without merging. Of course, it is better to only put strings with
> the same alignment into one SHF_MERGE section, since the linker can only
> guess what alignment a string requires (the guess is see how much aligned is
> beginning of string against start of section and taking a minimum of this
> value and actual section alignment).
> Ok to commit? With this patch in, gcc bootstrapped.
> 

I haven't seen any comments on this patch. I'd like to see it in.


H.J.


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