Subject: Re: SHAREDSTRINGS build doesn't.
To: None <>
From: Valeriy E. Ushakov <>
List: current-users
Date: 11/20/2003 00:26:50
On Wed, Nov 19, 2003 at 11:59:12 -0800, Greywolf wrote:

> VEU> In-tree gnu tools can do the string merging themselves.  Including
> VEU> merging strings from *different* files.
> As it stands, though, they don't, at least not visibly.

They doesn't too "tail-merging", but they do merge identical strings.
See -fmerge-constants option to gcc (turned on with -O already).  E.g.

$ uname -a
NetBSD nada 1.6ZF NetBSD 1.6ZF (NADA) #4: Tue Nov 18 02:10:21 MSK 2003  uwe@sampo:/export/netbsd/cvs/src/sys/arch/hpcsh/compile/NADA hpcsh
$ gcc --version | sed 1q
gcc (GCC) 3.3.2 (NetBSD nb1 20031026)
$ ld --version | sed 1q
GNU ld version
$ strings foo.o | grep hello
hello, world
$ strings bar.o | grep hello
hello, world
$ strings foo | grep hello
hello, world
$ ./foo
0x400b74 "hello, world"
0x400b74 "hello, world"

Where the two "hello, world" strings are defined in foo.c and bar.c
and are merged into one string in the final executable (linked from
foo.o and bar.o).  It just prints each string as %p and %s and you can
see that they have been merged.

SY, Uwe
--                         |       Zu Grunde kommen            |       Ist zu Grunde gehen