Bug 10133 - no string merge in .shstrtab?
Summary: no string merge in .shstrtab?
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.20
: P2 minor
Target Milestone: ---
Assignee: Ian Lance Taylor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-07 04:13 UTC by Alan Modra
Modified: 2009-06-23 07:07 UTC (History)
1 user (show)

See Also:
Host:
Target: i686-linux
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Modra 2009-05-07 04:13:07 UTC
gold does not appear to merge strings in .shstrtab.  For example, in
two_file_relocatable.o .shstrtab I see both ".rel.eh_frame" and ".eh_frame".
Comment 1 Ian Lance Taylor 2009-05-08 05:26:41 UTC
gold currently only merges strings in string sections if you use -O2.  See the
comment around line 393 of stringpool.cc.  Does that make sense to you?  Perhaps
we should do the optimization if the string section size is small?

Comment 2 cvs-commit@gcc.gnu.org 2009-06-23 07:04:26 UTC
Subject: Bug 10133

CVSROOT:	/cvs/src
Module name:	src
Changes by:	ian@sourceware.org	2009-06-23 07:04:10

Modified files:
	gold           : ChangeLog layout.cc stringpool.cc stringpool.h 

Log message:
	PR 10133
	* stringpool.h (class Stringpool_template): Add optimize_ field.
	(Stringpool_template::set_optimize): New function.
	* stringpool.cc (Stringpool_template::Stringpool_template):
	Initialize optimize_ field.
	(Stringpool_template::set_string_offsets): Test local optimize
	fild rather than parameter.
	* layout.cc (Layout::Layout): Call set_optimize on the section
	name stringpool.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.244&r2=1.245
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/layout.cc.diff?cvsroot=src&r1=1.127&r2=1.128
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/stringpool.cc.diff?cvsroot=src&r1=1.28&r2=1.29
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/stringpool.h.diff?cvsroot=src&r1=1.22&r2=1.23

Comment 3 Ian Lance Taylor 2009-06-23 07:07:31 UTC
I committed a patch to optimize the section name pool, since that is a case
where matches are likely and the string pool is normally small.