DF_1_INTIFIRST
H . J . Lu
hjl@valinux.com
Sat Feb 3 11:59:00 GMT 2001
On Sat, Feb 03, 2001 at 12:17:00AM -0800, Ulrich Drepper wrote:
> "H . J . Lu" <hjl@valinux.com> writes:
>
> > May I make a suggestion? Since initfini.c and pt-initfini.c are
> > very similar, can we combine them into one and use
>
> I don't want to have this interdependency between the libc itself and
> the add-on. There might (and will be) other thread implementations
> which don't need this.
>
The interdependency is there already. I really don't like code
duplications. We may forget to fix the other one when we fix a bug.
How about something like this?
--
H.J. Lu (hjl@valinux.com)
---
Index: sysdeps/generic/initfini.c
===================================================================
RCS file: /work/cvs/gnu/glibc/sysdeps/generic/initfini.c,v
retrieving revision 1.1.1.5
diff -u -p -r1.1.1.5 initfini.c
--- sysdeps/generic/initfini.c 2000/11/21 02:15:46 1.1.1.5
+++ sysdeps/generic/initfini.c 2001/02/03 19:57:34
@@ -1,5 +1,5 @@
/* Special .init and .fini section support.
- Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it
@@ -62,7 +62,16 @@ asm ("\n/*@TESTS_END*/");
/* The beginning of _init: */
asm ("\n/*@_init_PROLOG_BEGINS*/");
+#ifdef CALL_INTIFIRST
static void
+call_initialize_minimal (void)
+{
+ extern void CALL_INTIFIRST ();
+ CALL_INTIFIRST ()
+}
+#endif
+
+static void
call_gmon_start(void)
{
extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/
@@ -77,6 +86,10 @@ extern void _init (void);
void
_init (void)
{
+#ifdef CALL_INTIFIRST
+ call_initialize_minimal ();
+#endif
+
/* We cannot use the normal constructor mechanism in gcrt1.o because it
appears before crtbegin.o in the link, so the header elt of .ctors
would come after the elt for __gmon_start__. One approach is for
More information about the Libc-hacker
mailing list