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] |
| Other format: | [Raw text] | |
>>>>> On Wed, 19 Nov 2003 18:25:37 -0800, Ulrich Drepper <drepper@redhat.com> said:
Uli> David Mosberger wrote:
>> Ah, in fact there is already an ia64-specific version. I missed
>> it at first. Turns out the problem really was worse: not only
>> was it using .init, but the unwind directives for both _init and
>> _fini were missing! With the proper unwind info for _init and
>> _fini, the old code was lucky enough to work fine, but I still
>> think it's better to switch to .init_array both for cleanliness
>> and consistency reasons. LinuxThreads had the same problem.
>> Patch to fix both is attached.
Uli> Mostly OK. But there still is a .init section and a DT_INIT
Uli> entry. The later must go. I tried to simply remove the code
Uli> for the .init section but this causes some tests to fail.
I don't have the complete picture of how pt-initfini.c is being used,
but if the goal is simply to ensure that (a)
__pthread_initialize_minimal_internal gets called first and (b) to
enable other code to specify their own constructors/destructors, then
I think the attached patch might work. It certainly would be much
cleaner this way and it does get rid of the DT_INIT and DT_FINI
entries.
The patch seems to work fine for me (same "make check" results as
before). I didn't update the linuxthreads version yet, but if this
patch looks fine, that's trivial to do.
--david
Index: nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c,v
retrieving revision 1.1
diff -u -r1.1 pt-initfini.c
--- nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c 11 Mar 2003 09:20:41 -0000 1.1
+++ nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c 20 Nov 2003 04:01:06 -0000
@@ -36,6 +36,22 @@
* crtn.s puts the corresponding function epilogues
in the .init and .fini sections. */
+#include <stddef.h>
+
+#ifdef HAVE_INITFINI_ARRAY
+
+__asm__ ("\n\
+#include \"defs.h\"\n\
+\n\
+/*@HEADER_ENDS*/\n\
+\n\
+/*@_init_PROLOG_BEGINS*/\n\
+ .xdata8 \".init_array\",@fptr(__pthread_initialize_minimal_internal)\n\
+/*@_init_PROLOG_ENDS*/\n\
+");
+
+#else
+
__asm__ ("\n\
\n\
#include \"defs.h\"\n\
@@ -48,13 +64,16 @@
.global _init#\n\
.proc _init#\n\
_init:\n\
+ .prologue\n\
+ .save ar.pfs, r34\n\
alloc r34 = ar.pfs, 0, 3, 0, 0\n\
+ .vframe r32\n\
mov r32 = r12\n\
+ .save rp, r33\n\
mov r33 = b0\n\
+ .body\n\
adds r12 = -16, r12\n\
;;\n\
-/* we could use r35 to save gp, but we use the stack since that's what\n\
- * all the other init routines will do --davidm 00/04/05 */\n\
st8 [r12] = gp, -16\n\
br.call.sptk.many b0 = __pthread_initialize_minimal_internal# ;;\n\
;;\n\
@@ -62,7 +81,6 @@
;;\n\
ld8 gp = [r12]\n\
;;\n\
- .align 16\n\
.endp _init#\n\
\n\
/*@_init_PROLOG_ENDS*/\n\
@@ -83,12 +101,16 @@
.global _fini#\n\
.proc _fini#\n\
_fini:\n\
+ .prologue\n\
+ .save ar.pfs, r34\n\
alloc r34 = ar.pfs, 0, 3, 0, 0\n\
+ .vframe r32\n\
mov r32 = r12\n\
+ .save rp, r33\n\
mov r33 = b0\n\
+ .body\n\
adds r12 = -16, r12\n\
;;\n\
- .align 16\n\
.endp _fini#\n\
\n\
/*@_fini_PROLOG_ENDS*/\n\
@@ -106,3 +128,5 @@
/*@TRAILER_BEGINS*/\n\
.weak __gmon_start__#\n\
");
+
+#endif
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |