From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7026 invoked by alias); 18 Apr 2002 18:14:01 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 7019 invoked from network); 18 Apr 2002 18:14:01 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 18 Apr 2002 18:14:01 -0000 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id LAA27666; Thu, 18 Apr 2002 11:13:59 -0700 (PDT) Message-ID: <3CBEFC1F.3F0B6D1D@redhat.com> Date: Thu, 18 Apr 2002 11:14:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: Kevin Buettner CC: gdb-patches@sources.redhat.com Subject: Re: [PATCH] cvexpr.c: Don't let linker delete unused globals References: <1020418132243.ZM6877@localhost.localdomain> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-04/txt/msg00600.txt.bz2 Kevin Buettner wrote: > > On AIX, I was seeing lots of failures in gdb.base/code-expr.exp and > gdb.base/cvexpr.exp due to the fact that the linker deletes unused > symbols. The patch below fixes these failures. > > Committed as obvious. Wow, that's really sad, to have to add all that code for such a trivial reason. I'm sure there are other tests in gdb.base that also make use of symbols that don't get called. Isn't there some option that you can give to the linker to tell it not to remove these? > > * gdb.base/cvexpr.c (use): New function. > (main): Invoke use() on all global variables to prevent > some linkers from deleting these otherwise unused symbols. > > Index: cvexpr.c > =================================================================== > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/cvexpr.c,v > retrieving revision 1.1 > diff -u -p -r1.1 cvexpr.c > --- cvexpr.c 15 Nov 2001 02:16:59 -0000 1.1 > +++ cvexpr.c 18 Apr 2002 12:59:53 -0000 > @@ -273,8 +273,162 @@ unsigned long long (*v_unsigned_long_lon > float (*v_float_func) (int, int*); > double (*v_double_func) (int, int*); > > - > +void use (void *p) > +{ > +} > > int main () > { > + use (&v_char); > + use (&v_signed_char); > + use (&v_unsigned_char); > + > + use (&v_short); > + use (&v_signed_short); > + use (&v_unsigned_short); > + > + use (&v_int); > + use (&v_signed_int); > + use (&v_unsigned_int); > + > + use (&v_long); > + use (&v_signed_long); > + use (&v_unsigned_long); > + > + use (&v_long_long); > + use (&v_signed_long_long); > + use (&v_unsigned_long_long); > + > + use (&v_float); > + use (&v_double); > + > + use (v_char_array); > + use (v_signed_char_array); > + use (v_unsigned_char_array); > + > + use (v_short_array); > + use (v_signed_short_array); > + use (v_unsigned_short_array); > + > + use (v_int_array); > + use (v_signed_int_array); > + use (v_unsigned_int_array); > + > + use (v_long_array); > + use (v_signed_long_array); > + use (v_unsigned_long_array); > + > + use (v_float_array); > + use (v_double_array); > + > + use (v_char_pointer); > + use (v_signed_char_pointer); > + use (v_unsigned_char_pointer); > + > + use (v_short_pointer); > + use (v_signed_short_pointer); > + use (v_unsigned_short_pointer); > + > + use (v_int_pointer); > + use (v_signed_int_pointer); > + use (v_unsigned_int_pointer); > + > + use (v_long_pointer); > + use (v_signed_long_pointer); > + use (v_unsigned_long_pointer); > + > + use (v_float_pointer); > + use (v_double_pointer); > + > + use (v_char_pointer_pointer); > + use (v_signed_char_pointer_pointer); > + use (v_unsigned_char_pointer_pointer); > + > + use (v_short_pointer_pointer); > + use (v_signed_short_pointer_pointer); > + use (v_unsigned_short_pointer_pointer); > + > + use (v_int_pointer_pointer); > + use (v_signed_int_pointer_pointer); > + use (v_unsigned_int_pointer_pointer); > + > + use (v_long_pointer_pointer); > + use (v_signed_long_pointer_pointer); > + use (v_unsigned_long_pointer_pointer); > + > + use (v_float_pointer_pointer); > + use (v_double_pointer_pointer); > + > + use (v_char_array_pointer); > + use (v_signed_char_array_pointer); > + use (v_unsigned_char_array_pointer); > + > + use (v_short_array_pointer); > + use (v_signed_short_array_pointer); > + use (v_unsigned_short_array_pointer); > + > + use (v_int_array_pointer); > + use (v_signed_int_array_pointer); > + use (v_unsigned_int_array_pointer); > + > + use (v_long_array_pointer); > + use (v_signed_long_array_pointer); > + use (v_unsigned_long_array_pointer); > + > + use (v_float_array_pointer); > + use (v_double_array_pointer); > + > + use (v_char_pointer_array); > + use (v_signed_char_pointer_array); > + use (v_unsigned_char_pointer_array); > + > + use (v_short_pointer_array); > + use (v_signed_short_pointer_array); > + use (v_unsigned_short_pointer_array); > + > + use (v_int_pointer_array); > + use (v_signed_int_pointer_array); > + use (v_unsigned_int_pointer_array); > + > + use (v_long_pointer_array); > + use (v_signed_long_pointer_array); > + use (v_unsigned_long_pointer_array); > + > + use (v_float_pointer_array); > + use (v_double_pointer_array); > + > + use (&v_struct1); > + use (&v_struct2); > + use (&v_struct3); > + > + use (&v_union); > + use (&v_union2); > + use (&v_union3); > + > + use (&v_boolean); > + use (&v_boolean2); > + use (&v_misordered); > + > + use (v_char_func); > + use (v_signed_char_func); > + use (v_unsigned_char_func); > + > + use (v_short_func); > + use (v_signed_short_func); > + use (v_unsigned_short_func); > + > + use (v_int_func); > + use (v_signed_int_func); > + use (v_unsigned_int_func); > + > + use (v_long_func); > + use (v_signed_long_func); > + use (v_unsigned_long_func); > + > + use (v_long_long_func); > + use (v_signed_long_long_func); > + use (v_unsigned_long_long_func); > + > + use (v_float_func); > + use (v_double_func); > }