Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] cvexpr.c: Don't let linker delete unused globals
Date: Thu, 18 Apr 2002 11:14:00 -0000	[thread overview]
Message-ID: <3CBEFC1F.3F0B6D1D@redhat.com> (raw)
In-Reply-To: <1020418132243.ZM6877@localhost.localdomain>

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);
>  }


  reply	other threads:[~2002-04-18 18:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-18  6:23 Kevin Buettner
2002-04-18 11:14 ` Michael Snyder [this message]
2002-04-18 11:49   ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CBEFC1F.3F0B6D1D@redhat.com \
    --to=msnyder@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kevinb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox