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 21:39:03 -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> Hi David, Your patch
HJ> http://gcc.gnu.org/ml/gcc-cvs/2003-04/msg00033.html
HJ> may have caused massive libjava failures on Linux/ia64:
HJ> http://gcc.gnu.org/ml/gcc-testresults/2003-03/msg01626.html
HJ> http://gcc.gnu.org/ml/gcc-testresults/2003-04/msg00087.html
Hmmh, I'm sorry (and surprised) to hear that.
HJ> I have almost narrowed it down to your patch. I couldn't find
HJ> any discussions in the gcc-patches archive about your
HJ> patch. Have you verified your patch with java enabled on
HJ> Linux/ia64?
No, last time I tried (perhaps 3 months ago), gcj/ia64 wasn't even
building, so I ended up configuring just gcc and g++. I just started
a build with gcj enabled. Let's see how far it gets.
In the meantime, you may want to try the attached patch. There should
be no functional change, but it's easier if we all can work off the
latest version of the file.
--david
--
From: David Mosberger <davidm@linux.hpl.hp.com>
To: rth@redhat.com
cc: gcc-patches@gcc.gnu.org, davidm@linux.hpl.hp.com
Subject: some more ia64/crt{begin,end}.asm cleanup
Date: Fri, 25 Apr 2003 15:13:42 -0700
Reply-to: davidm@hpl.hp.com
X-URL: http://www.hpl.hp.com/personal/David_Mosberger/
Here is some more cleanup for the ia64 versions of crtbegin.asm and
crtend.asm. As per your suggestion/concern, I tried to get the file
to compile with the Intel assembler (again). It does work now, with
the exception that I couldn't find a ".section .init_array" syntax
that works both with gas and ias without producing an error or
warning. I supposed we could add an #ifdef, but I'm not sure anyone
really cares anymore about building with ias, so I didn't want to make
the code needlessly ugly.
Other changes include adding the missing ".prologue" in
__do_jv_register_classes and registering __do_global_ctors_aux() in
crtend.asm, so it can "static" instead of "global" scope.
The patch is relative to the current CVS gcc tree.
Please apply if it looks ok.
Thanks,
--david
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 25 Apr 2003 21:18:48 -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,13 +193,14 @@
;;
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
movl out0 = @gprel(__JCR_LIST__)
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 25 Apr 2003 21:18:48 -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
@@ -94,9 +93,9 @@
cmp.eq p6, p0 = -1, loc3
nop 0
-(p6) br.cond.spnt.few 2f
+(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: nop.m 0
mov rp = loc1
mov ar.pfs = loc2