This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Ping __frame_state_for checks


Hi Uli,

Looks like my __frame_state_for checks patch fell through the cracks.  See

   http://sources.redhat.com/ml/libc-hacker/2001-08/msg00184.html

for the details.  Meanwhile, I've actually run "make check" on
i586-pc-linux-gnu, and it passes this particular test.

Attached, you find a patch against the current sources.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* configure.in: Add test for __frame_state_for.
	* config.make.in (have-frame-state-for): New variable.
	* csu/Makefile [have-frame-state-for=yes] (tests): Add test-eh.
	* csu/test-eh.c: New file.

Index: configure.in
===================================================================
RCS file: /cvs/glibc/libc/configure.in,v
retrieving revision 1.326
diff -u -p -r1.326 configure.in
--- configure.in 2001/08/29 18:05:56 1.326
+++ configure.in 2001/10/06 14:29:56
@@ -1373,6 +1373,12 @@ static)
   ;;
 esac
 
+AC_CACHE_CHECK(for __frame_state_for, libc_cv_gcc_frame_state_for,
+               [AC_TRY_LINK(, [__frame_state_for();],
+			    libc_cv_gcc_frame_state_for=yes,
+                            libc_cv_gcc_frame_state_for=no)])
+AC_SUBST(libc_cv_gcc_frame_state_for)
+
 dnl Check whether compiler understands __builtin_expect.
 AC_CACHE_CHECK(for __builtin_expect, libc_cv_gcc_builtin_expect,
 [cat > conftest.c <<EOF
Index: config.make.in
===================================================================
RCS file: /cvs/glibc/libc/config.make.in,v
retrieving revision 1.80
diff -u -p -r1.80 config.make.in
--- config.make.in 2001/08/29 22:42:50 1.80
+++ config.make.in 2001/10/06 14:29:56
@@ -46,6 +46,7 @@ have-Bgroup = @libc_cv_Bgroup@
 need-nopic-initfini = @nopic_initfini@
 with-cvs = @with_cvs@
 old-glibc-headers = @old_glibc_headers@
+have-frame-state-for = @libc_cv_gcc_frame_state_for@
 
 versioning = @VERSIONING@
 oldest-abi = @oldest_abi@
Index: csu/Makefile
===================================================================
RCS file: /cvs/glibc/libc/csu/Makefile,v
retrieving revision 1.50
diff -u -p -r1.50 Makefile
--- csu/Makefile 2001/07/06 04:54:45 1.50
+++ csu/Makefile 2001/10/06 14:29:56
@@ -123,6 +123,10 @@ extra-objs += abi-note.o init.o
 asm-CPPFLAGS += -I$(objpfx).
 endif
 
+ifeq (yes,$(have-frame-state-for))
+tests += test-eh
+endif
+
 include ../Rules
 
 # Make these in the lib pass so they're available in time to link things with.
0a1,106
> /* Tests for __frame_state_for.
>    Copyright (C) 2001 Free Software Foundation, Inc.
>    This file is part of the GNU C Library.
>    Contributed by Mark Kettenis <kettenis@gnu.org>, 2001.
> 
>    The GNU C Library is free software; you can redistribute it and/or
>    modify it under the terms of the GNU Lesser General Public
>    License as published by the Free Software Foundation; either
>    version 2.1 of the License, or (at your option) any later version.
> 
>    The GNU C Library is distributed in the hope that it will be useful,
>    but WITHOUT ANY WARRANTY; without even the implied warranty of
>    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>    Lesser General Public License for more details.
> 
>    You should have received a copy of the GNU Lesser General Public
>    License along with the GNU C Library; if not, write to the Free
>    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
>    02111-1307 USA.  */
> 
> #include <search.h>
> #include <stdio.h>
> #include <stdlib.h>
> 
> /* Prototype for our test function.  */
> extern int do_test (int argc, char *argv[]);
> 
> /* This defines the `main' function and some more.  */
> #include <test-skeleton.c>
> 
> struct frame_state;
> 
> /* Not declared in any header.  */
> extern struct frame_state *__frame_state_for (void *, struct frame_state *);
> 
> /* Exit status.  */
> int result = EXIT_SUCCESS;
> 
> int
> compare (const void *a, const void *b)
> {
>   /* 1K should be enough for all currently supported platforms.  */
>   struct frame_state *udata = alloca (1024);
> 
>   /* The tests below are arranged such that this function is always
>      called such that A or B always contains a pointer to the name of
>      the function being tested.  */
>   const char *func = *(char **) a ?: *(char **)b;
>   void *pc;
> 
>   puts (func);
> 
>   pc = __builtin_extract_return_addr (__builtin_return_address (0)) - 1;
>   if (__frame_state_for (pc, udata) == NULL)
>     {
>       fprintf (stderr, "Cannot find frame info for %s\n", func);
>       result = EXIT_FAILURE;
>     }
> 
>   return 0;
> }
> 
> int
> do_test (int argc, char *argv[])
> {
>   {
>     void *root = NULL;
>     char *key1 = NULL;
>     const char *key2 = "tsearch";
> 
>     tsearch (&key1, &root, compare);
>     tsearch (&key2, &root, compare);
>   }
> 
>   {
>     const char *key = "lfind";
>     const char *array[] = { key, NULL };
>     int nmemb = 2;
> 
>     lfind (&key, array, &nmemb, sizeof (char), compare);
>   }
> 
>   {
>     const char *key = "lsearch";
>     const char *array[] = { key, NULL };
>     int nmemb = 2;
> 
>     lsearch (&key, array, &nmemb, sizeof (char), compare);
>   }
> 
>   {
>     const char *key = "bsearch";
>     const char *array[] = { key, NULL };
> 
>     bsearch (&key, array, 2, sizeof (char *), compare);
>   }
> 
>   {
>     const char *func = "qsort";
>     const char *array[] = { func, NULL };
> 
>     qsort (array, 2, sizeof (char *), compare);
>   }
> 
>   return result;
> }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]