This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Your ia64 patch may have broken libjava
- From: David Mosberger <davidm at napali dot hpl dot hp dot com>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: David Mosberger <davidm at hpl dot hp dot com>, gcc at gcc dot gnu dot org,rth at redhat dot com
- Date: Tue, 6 May 2003 22:47:22 -0700
- Subject: Re: Your ia64 patch may have broken libjava
- References: <20030506195421.A14471@lucon.org>
- Reply-to: davidm at hpl dot hp dot com
>>>>> On Tue, 6 May 2003 19:54:21 -0700, "H. J. Lu" <hjl@lucon.org> said:
HJ> Your patch
HJ> http://gcc.gnu.org/ml/gcc-cvs/2003-04/msg00033.html
HJ> may have caused massive libjava failures on Linux/ia64.
OK, I think I found the culprit: too much gp optimization. The patch below
is relative to the CVS tree and includes the changes I sent previously plus
the fix to save/restore gp in __do_jv_register_classes().
Unfortunately, I still can't built gcj:
make[1]: Entering directory `/usr/src/misc/gcc-build/ia64-hp-linux/libjava'
make[1]: *** No rule to make target `java/util/prefs/NodeChangeListener.java', needed by `java/util/prefs/NodeChangeListener.class'. Stop.
make[1]: Leaving directory `/usr/src/misc/gcc-build/ia64-hp-linux/libjava'
make: *** [all-target-libjava] Error 2
Don't know what this is about. Can you rerun the test with the patch
applied?
--david
2003-05-06 David Mosberger <davidm@hpl.hp.com>
* config/ia64/crtbegin.asm (__do_jv_register_classes): Don't forget
to preserve gp (fixes bug introduced by my 4/25 changes).
* config/ia64/crtend.asm (__do_global_ctors_au): Ditto.
2003-04-25 David Mosberger <davidm@hpl.hp.com>
* config/ia64/crtbegin.asm (__do_jv_register_classes): Add missing
.prologue directive.
Use .skip instead of data8 for .bss section to make Intel
Assembler (ias) happy. Minor whitespace fixups. Make "nop 0"
explicit in the .mib bundles and remove the unnecessary stop
bits. Replace local labels with normal labels, to make ias
happy. Don't register __do_global_ctors_aux here, do it in
crtend.asm instead.
* config/ia64/crtend.asm [HAVE_INIT_FINI_ARRAY]: Register
__do_global_ctors_aux in .init_array section instead of
declaring it as a hidden global. Replace local labels with
ordinary labels to make ias happy.
Index: config/ia64/crtbegin.asm
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/ia64/crtbegin.asm,v
retrieving revision 1.15
diff -u -r1.15 crtbegin.asm
--- config/ia64/crtbegin.asm 1 Apr 2003 23:29:34 -0000 1.15
+++ config/ia64/crtbegin.asm 7 May 2003 05:43:50 -0000
@@ -48,20 +48,20 @@
data8 __dso_handle
#else
.section .bss
+ .align 8
__dso_handle:
- data8 0
+ .skip 8
#endif
.hidden __dso_handle
#ifdef HAVE_INITFINI_ARRAY
-.section .fini_array,"a"
+.section .fini_array, "a"
data8 @fptr(__do_global_dtors_aux)
-.section .init_array,"a"
+.section .init_array, "a"
data8 @fptr(__do_jv_register_classes)
- data8 @fptr(__do_global_ctors_aux)
#else /* !HAVE_INITFINI_ARRAY */
/*
@@ -88,9 +88,9 @@
;;
}
{ .mib
+ nop 0
mov b6 = r2
br.call.sptk.many b0 = b6
- ;;
}
/* Likewise for _init. */
@@ -106,9 +106,9 @@
;;
}
{ .mib
+ nop 0
mov b6 = r2
br.call.sptk.many b0 = b6
- ;;
}
#endif /* !HAVE_INITFINI_ARRAY */
@@ -127,8 +127,7 @@
mov loc2 = gp
nop 0
- br.sptk.many 1f
- ;;
+ br.sptk.many .entry
#else
/*
if (__cxa_finalize)
@@ -164,7 +163,7 @@
nop 0
nop 0
- br.sptk.many 1f
+ br.sptk.many .entry
#endif
/*
do {
@@ -172,7 +171,7 @@
(*(dtor_ptr-1)) ();
} while (dtor_ptr);
*/
-0:
+.loop:
st8 [loc0] = r15 // update dtor_ptr (in memory)
ld8 r17 = [r16], 8 // r17 <- dtor's entry-point
nop 0
@@ -182,7 +181,7 @@
mov b6 = r17
br.call.sptk.many rp = b6
-1: ld8 r15 = [loc0] // r15 <- dtor_ptr (gp-relative)
+.entry: ld8 r15 = [loc0] // r15 <- dtor_ptr (gp-relative)
;;
add r16 = r15, loc2 // r16 <- dtor_ptr (absolute)
adds r15 = 8, r15
@@ -194,15 +193,16 @@
;;
cmp.ne p6, p0 = r0, r16
-(p6) br.cond.sptk.few 0b
+(p6) br.cond.sptk.few .loop
br.ret.sptk.many rp
.endp __do_global_dtors_aux
.align 32
.proc __do_jv_register_classes
__do_jv_register_classes:
+ .prologue
.save ar.pfs, r33
- alloc loc1 = ar.pfs, 0, 2, 1, 0
+ alloc loc1 = ar.pfs, 0, 3, 1, 0
movl out0 = @gprel(__JCR_LIST__)
;;
@@ -224,15 +224,15 @@
ld8 r15 = [r14], 8
;;
- ld8 gp = [r14]
+ nop 0
mov b6 = r15
- nop 0
- nop 0
+ mov loc2 = gp
+ ld8 gp = [r14]
br.call.sptk.many rp = b6
;;
- nop 0
+ mov gp = loc2
mov rp = loc0
mov ar.pfs = loc1
Index: config/ia64/crtend.asm
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/ia64/crtend.asm,v
retrieving revision 1.11
diff -u -r1.11 crtend.asm
--- config/ia64/crtend.asm 1 Apr 2003 23:29:35 -0000 1.11
+++ config/ia64/crtend.asm 7 May 2003 05:43:50 -0000
@@ -33,7 +33,12 @@
__JCR_END__:
data8 0
-#ifndef HAVE_INITFINI_ARRAY
+#ifdef HAVE_INITFINI_ARRAY
+
+.section .init_array, "a"
+ data8 @fptr(__do_global_ctors_aux)
+
+#else /* !HAVE_INITFINI_ARRAY */
/*
* Fragment of the ELF _init routine that invokes our dtor cleanup.
*
@@ -66,12 +71,6 @@
.text
.align 32
-#ifdef HAVE_INITFINI_ARRAY
- /* This is referenced from crtbegin.o. */
- .globl __do_global_ctors_aux
- .type __do_global_ctors_aux,@function
- .hidden __do_global_ctors_aux
-#endif
.proc __do_global_ctors_aux
__do_global_ctors_aux:
.prologue
@@ -80,7 +79,7 @@
(*p) ();
*/
.save ar.pfs, r34
- alloc loc2 = ar.pfs, 0, 4, 0, 0
+ alloc loc2 = ar.pfs, 0, 5, 0, 0
movl loc0 = @gprel(__CTOR_END__ - 8)
;;
@@ -93,10 +92,10 @@
;;
cmp.eq p6, p0 = -1, loc3
- nop 0
-(p6) br.cond.spnt.few 2f
+ mov loc4 = gp
+(p6) br.cond.spnt.few .exit
-0: ld8 r15 = [loc3], 8
+.loop: ld8 r15 = [loc3], 8
;;
ld8 gp = [loc3]
mov b6 = r15
@@ -108,9 +107,9 @@
cmp.ne p6, p0 = -1, loc3
nop 0
-(p6) br.cond.sptk.few 0b
+(p6) br.cond.sptk.few .loop
-2: nop.m 0
+.exit: mov gp = loc3
mov rp = loc1
mov ar.pfs = loc2