crtbegin.asm (__do_jv_register_classes): Don't forget to preserve gp.
authorDavid Mosberger <davidm@hpl.hp.com>
Wed, 7 May 2003 22:29:33 +0000 (22:29 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 7 May 2003 22:29:33 +0000 (15:29 -0700)
        * config/ia64/crtbegin.asm (__do_jv_register_classes): Don't
        forget to preserve gp.
        * config/ia64/crtend.asm (__do_global_ctors_au): Ditto.

        * 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.

From-SVN: r66584

gcc/ChangeLog
gcc/config/ia64/crtbegin.asm
gcc/config/ia64/crtend.asm

index 87c5774c9761e729b61bf0d60cfffa5711b567d6..fb935f1e0d6e0ce40ea01dc9d9c0ef053d0a0362 100644 (file)
@@ -1,3 +1,23 @@
+2003-05-07  David Mosberger <davidm@hpl.hp.com>
+
+        * config/ia64/crtbegin.asm (__do_jv_register_classes): Don't
+       forget to preserve gp.
+        * config/ia64/crtend.asm (__do_global_ctors_au): Ditto.
+
+        * 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.
+
 2003-05-07  Richard Henderson  <rth@redhat.com>
 
         PR c++/10570
index c64de028eef4008c31b3548864e8fe1d9398e771..540cee2801f934af9246fb9fc6ca8f8db3d5add8 100644 (file)
@@ -48,20 +48,20 @@ __dso_handle:
        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 @@ __dso_handle:
          ;;
        }
        { .mib
+         nop 0
          mov b6 = r2
          br.call.sptk.many b0 = b6
-         ;;
        }
 
 /* Likewise for _init.  */
@@ -106,9 +106,9 @@ __dso_handle:
          ;;
        }
        { .mib
+         nop 0
          mov b6 = r2
          br.call.sptk.many b0 = b6
-         ;;
        }
 #endif /* !HAVE_INITFINI_ARRAY */
 
@@ -127,8 +127,7 @@ __do_global_dtors_aux:
 
        mov loc2 = gp
        nop 0
-       br.sptk.many 1f
-       ;;
+       br.sptk.many .entry
 #else
        /*
                if (__cxa_finalize)
@@ -164,7 +163,7 @@ __do_global_dtors_aux:
 
        nop 0
        nop 0
-       br.sptk.many 1f
+       br.sptk.many .entry
 #endif
        /*
                do {
@@ -172,7 +171,7 @@ __do_global_dtors_aux:
                  (*(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 @@ __do_global_dtors_aux:
        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 @@ __do_global_dtors_aux:
        ;;
 
        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 @@ __do_jv_register_classes:
 
        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 f357e5652f4ad29343149a535dbe8fc54931bf21..885e0f946e525204eef2412f1ee038dd389bb9ed 100644 (file)
@@ -33,7 +33,12 @@ __DTOR_END__:
 __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 @@ __JCR_END__:
 
 .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 @@ __do_global_ctors_aux:
                  (*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 @@ __do_global_ctors_aux:
        ;;
 
        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 @@ __do_global_ctors_aux:
 
        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