Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Apr 2005 10:20:35 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Roland Smith <rsmith@xs4all.nl>
Cc:        freebsd-amd64@freebsd.org
Subject:   Re: INCLUDE_CONFIG_FILE broken?
Message-ID:  <20050416093349.I5888@epsplex.bde.org>
In-Reply-To: <20050415220455.GB1698@slackbox.xs4all.nl>
References:  <E1DEjZu-0007MN-RR@cs1.cs.huji.ac.il> <86k6ntw6f8.fsf@xps.des.no> <20050415220455.GB1698@slackbox.xs4all.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 16 Apr 2005, Roland Smith wrote:

> On Fri, Apr 15, 2005 at 12:27:44PM -0700, Peter Wemm wrote:
>> gcc-3.4 does entire-file optimization, while 3.3 and earlier look at
>> functions at a time.  As a result, gcc is now very good at finding
>> static unused things.

This doesn't explain it.  Variables declared as "static const char []" have
been specially handled by gcc for 15 years ago.  gcc doesn't warn about
ones that are not used in the source file, unlike ones declared as
"static char []".  This behaviour hasn't changed.  What has changed is
the removal of all unused static variables at optimization -O2 and higher.
Removing the "static const char []" ones is just a bug, especially since
it is done without warning.

>> We might need to do something different.  I'd almost like to insert
>> the config file into its own ELF section via objcopy...

You could just use the existing mechanism __IDSTRING(), preferably
after fixing it to actually work.  (__IDSTRING() generates invalid
asm if the string has a newline in it.  Among other bugs, this breaks
most uses of __COPYRIGHT().)

> Why not use gcc's __attribute__ ((unused))?

Because it is unportable and backwards.  __attribute__((used)) works.
Putting the string in a separate section is better for an id string,
but the attribute would be better than bogusly exporting the symbol
for things like functions that are only intended to be called from
debuggers.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050416093349.I5888>