Subject: Re: Problem with egcs
To: Brian Stark <bstark@siemens-psc.com>
From: Todd Vierling <tv@pobox.com>
List: netbsd-help
Date: 03/01/1999 10:58:51
On Mon, 1 Mar 1999, Brian Stark wrote:

: I've discovered an annoying quirk in egcs 1.1.1. If I attempt to compile
: file 'alpha.c' with optimization enabled (-O, -O2, -O3), and this file
: only contains constants ('const int beta = 4;'), the resulting object
: file does not contain the constant symbols (verified by running 'nm
: alpha.o' and trying to link against alpha.o). However, if I compile
: with optimization disabled, the constant symbols do appear in the object
: file and I can link against alpha.o.
: 
: Has anyone else noticed this problem with egcs? 

>From my available platforms, one of which is egcs 1.1.1:

i386:

% cc -v
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
% cat x.c
const int beta = 4;
% cc -O3 -c x.c
% nm x.o
00000000 t ___gnu_compiled_c
00000000 T _beta
00000000 t gcc2_compiled.
% cat x2.c
static const int beta = 4;
% cc -O3 -c x2.c
% nm x2.o
00000000 t ___gnu_compiled_c
00000000 t _beta
00000000 t gcc2_compiled.

alpha:

% cc -v
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
% cat x.c
const int beta = 4;
% cc -O3 -c x.c
% nm x.o
0000000000000000 R beta
% cat x2.c
static const int beta = 4;
% cc -O3 -c x2.c
% nm x2.o
0000000000000000 r beta

Nope, I don't see it.  However, let me ask you this - are you compiling egcs
1.1.1 "out of the box" to run on NetBSD 1.3.x?  Or is your system
NetBSD-current, with the included egcs?  (egcs 1.1.x "out of the box" does
*not* work properly on NetBSD; this is one of my tasks to finish for the
upcoming NetBSD 1.4 release.)

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)