public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* another .fini vs. .fini_array problem
@ 2003-11-24 17:45 David Mosberger
  2003-11-26  7:36 ` Ulrich Drepper
  0 siblings, 1 reply; 3+ messages in thread
From: David Mosberger @ 2003-11-24 17:45 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: libc-hacker

OK, so I found yet another place where things were being put in the
.fini section (which causes unwind problems).  The patch below
fixes soinit.c so it puts _fini() in the .fini_array section if
it's available.  If it looks fine, please apply.

Thanks,

	--david

ChangeLog

2003-11-21  David Mosberger  <davidm@hpl.hp.com>

	* elf/soinit.c (_fini): Put _fini() in .init_array section if
	HAVE_INITFINI_ARRAY is defined.

Index: elf/soinit.c
===================================================================
RCS file: /cvs/glibc/libc/elf/soinit.c,v
retrieving revision 1.10
diff -u -r1.10 soinit.c
--- elf/soinit.c	16 Nov 2001 01:05:54 -0000	1.10
+++ elf/soinit.c	22 Nov 2003 02:57:12 -0000
@@ -78,7 +78,9 @@
 
 /* This function becomes the DT_FINI termination function
    for the C library.  */
+#ifndef HAVE_INITFINI_ARRAY
 void _fini (void) __attribute__ ((section (".fini"))); /* Just for kicks.  */
+#endif
 void
 _fini (void)
 {
@@ -96,3 +98,6 @@
 # endif
 #endif
 }
+#ifdef HAVE_INITFINI_ARRAY
+void (*_fini_ptr) (void) __attribute__ ((section (".fini_array"))) = &_fini;
+#endif

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: another .fini vs. .fini_array problem
  2003-11-24 17:45 another .fini vs. .fini_array problem David Mosberger
@ 2003-11-26  7:36 ` Ulrich Drepper
  2003-11-26  7:49   ` David Mosberger
  0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Drepper @ 2003-11-26  7:36 UTC (permalink / raw)
  To: davidm; +Cc: libc-hacker

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Mosberger wrote:

> 2003-11-21  David Mosberger  <davidm@hpl.hp.com>
> 
> 	* elf/soinit.c (_fini): Put _fini() in .init_array section if
> 	HAVE_INITFINI_ARRAY is defined.

This patch isn't quite correct.  You kept the function name as _fini
which caused DT_FINI and DT_FINI_ARRAY to be created.  I.e., the
destructor got called twice.  I've checked in a fixed version.

- -- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/xFMK2ijCOnn/RHQRAhwTAKChSWjxjgBz0y3ZXe9V5lVCJtE0lQCgv14Z
SWAKm+/+BBbgK9UZ5GcOXZo=
=IYVE
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: another .fini vs. .fini_array problem
  2003-11-26  7:36 ` Ulrich Drepper
@ 2003-11-26  7:49   ` David Mosberger
  0 siblings, 0 replies; 3+ messages in thread
From: David Mosberger @ 2003-11-26  7:49 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: davidm, libc-hacker

>>>>> On Tue, 25 Nov 2003 23:15:22 -0800, Ulrich Drepper <drepper@redhat.com> said:

  Uli> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

  Uli> David Mosberger wrote:

  >> 2003-11-21 David Mosberger <davidm@hpl.hp.com>

  >> * elf/soinit.c (_fini): Put _fini() in .init_array section if
  >> HAVE_INITFINI_ARRAY is defined.

  Uli> This patch isn't quite correct.  You kept the function name as
  Uli> _fini which caused DT_FINI and DT_FINI_ARRAY to be created.
  Uli> I.e., the destructor got called twice.  I've checked in a fixed
  Uli> version.

Ah, I didn't remember that the _fini() name had special significance.

Thanks for catching and fixing it!

	--david

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-11-26  7:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-24 17:45 another .fini vs. .fini_array problem David Mosberger
2003-11-26  7:36 ` Ulrich Drepper
2003-11-26  7:49   ` David Mosberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).