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


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

A patch for glibc 2.0/2.1


> 
> On Thu, 21 Jan 1999 07:56:15 -0800 (PST), H.J. Lu wrote:
> >> 
> >> > From: hjl@lucon.org (H.J. Lu)
> >> > Date: Wed, 20 Jan 1999 10:28:19 -0800 (PST)
> >> > Cc: libc-hacker@cygnus.com
> >> 
> >> > If that is a problem, we should have our own crt*.o for libm.so in glibc
> >> > 2.1.
> >> 
> >> How is libm.so different from any other shared library?  These
> >> low-level details shouldn't affect it specially.
> >> 
> >
> >It is because libm.so is a very basic shared library for C++.
> >libstdc++.so is linked with it. Zack doesn't want to see any
> >references to the C++ exception functions, even if they are
> >weak and external.
> 
> Actually, on a bit more thought, weak extern refs might be fine.  Emphasis
> on might.  With your patch you get weak extern refs in libc too, right?  And

Oooops. Here is a patch for glibc 2.0 and 2.1. It will make
those functions weak extern in libc.so. Ulrich, could you please
check it in for both glibc 2.0 and 2.1? Thanks.

> how do the eh functions appear in libstdc++ when you link it against libc
> 2.1 compiled with your patch?

Because libstdc++ will reference some other EH functions in
libgcc.a which will bring in those EH functions.

> 
> ... Since libm and in fact most of our extra libs don't have anything in
> .ctors, we might explore not linking crtbegin.o/crtend.o at all.  I think
> that's too risky to try this close to release.
> 

I don't like this idea. It breaks the ELF specs.



-- 
H.J. Lu (hjl@gnu.org)
-----
Thu Jan 21 07:54:33 1999  H.J. Lu  <hjl@gnu.org>

	* elf/soinit.c (__register_frame_info): Make it weak.
	(__deregister_frame_info): Likewise.
	(__register_frame): Likewise.
	(__deregister_frame): Likewise.
	(__libc_global_ctors): Check if __register_frame_info or
	__register_frame is none NULL, before calling them.
	(_fini): Check if __deregister_frame_info or
	__deregister_frame is none NULL, before calling them.

Index: elf/soinit.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/elf/soinit.c,v
retrieving revision 1.1.1.4
diff -u -p -r1.1.1.4 soinit.c
--- soinit.c	1998/01/09 16:39:31	1.1.1.4
+++ soinit.c	1999/01/21 18:47:34
@@ -34,9 +34,13 @@ struct object
 };
 extern void __register_frame_info (const void *, struct object *);
 extern void __deregister_frame_info (const void *);
+weak_extern (__register_frame_info);
+weak_extern (__deregister_frame_info);
 # else
 extern void __register_frame (const void *);
 extern void __deregister_frame (const void *);
+weak_extern (__register_frame);
+weak_extern (__deregister_frame);
 # endif
 #endif
 
@@ -48,12 +52,14 @@ __libc_global_ctors (void)
   run_hooks (__CTOR_LIST__);
 #ifdef HAVE_DWARF2_UNWIND_INFO
 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
-  {
-    static struct object ob;
-    __register_frame_info (__EH_FRAME_BEGIN__, &ob);
-  }
+  if (__register_frame_info)
+    {
+      static struct object ob;
+      __register_frame_info (__EH_FRAME_BEGIN__, &ob);
+    }
 # else
-  __register_frame (__EH_FRAME_BEGIN__);
+  if (__register_frame)
+    __register_frame (__EH_FRAME_BEGIN__);
 # endif
 #endif
 }
@@ -69,9 +75,11 @@ _fini (void)
   run_hooks (__DTOR_LIST__);
 #ifdef HAVE_DWARF2_UNWIND_INFO
 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
-  __deregister_frame_info (__EH_FRAME_BEGIN__);
+  if (__deregister_frame_info)
+    __deregister_frame_info (__EH_FRAME_BEGIN__);
 # else
-  __deregister_frame (__EH_FRAME_BEGIN__);
+  if (__deregister_frame)
+    __deregister_frame (__EH_FRAME_BEGIN__);
 # endif
 #endif
 }


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