]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* sysdeps/sparc/sparc32/elf.S: Rewrite for __libc_start_main. * sysdeps/sparc/sparc64...
authorRichard Henderson <rth@redhat.com>
Mon, 6 Apr 1998 17:40:58 +0000 (17:40 +0000)
committerRichard Henderson <rth@redhat.com>
Mon, 6 Apr 1998 17:40:58 +0000 (17:40 +0000)
* sysdeps/sparc/sparc32/elf.S: Rewrite for __libc_start_main.
* sysdeps/sparc/sparc64/elf.S: Likewise.

1998-04-06  Richard Henderson  <rth@cygnus.com>

ChangeLog
sysdeps/sparc/sparc32/elf/start.S
sysdeps/sparc/sparc64/elf/start.S

index 9727fdd236077840c448dc15cf77d9e7a94cb23d..93fc41c3dcfdd20e8c5cb82dc13d9b4432754cb0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1998-04-06  Richard Henderson  <rth@cygnus.com>
+
+       * sysdeps/sparc/sparc32/elf.S: Rewrite for __libc_start_main.
+       * sysdeps/sparc/sparc64/elf.S: Likewise.
+
 1998-04-06  Richard Henderson  <rth@cygnus.com>
 
        * sysdeps/unix/sysv/linux/sparc/sparc32/socket.S: Revert 03-01 change,
index 24715e68be147e391ff7a98bd38e9272d4378b5e..d45e0cedf41c8c5d898cfe79e72d7ff0218a2585 100644 (file)
@@ -1,5 +1,5 @@
 /* Startup code for elf32-sparc
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,56 +31,30 @@ _start:
        mov     %g0, %fp
        sub     %sp, 6*4, %sp
 
-  /* Save %g1.  When starting a binary via the dynamic linker, %g1
-     contains the address of the shared library termination function,
-     which we will register below with atexit() to be called by exit().
-     If we are statically linked, this will be NULL.  */
-
-  /* Do essential libc initialization (sp points to argc, argv, and envp)  */
-       call    __libc_init_first
-        mov    %g1, %l0
-
-  /* Now that we have the proper stack frame, register library termination
-     function, if there is any:  */
-
-       cmp     %l0, 0
-       beq     1f
-        nop
-       call    atexit
-        mov    %l0, %o0
-1:
-
   /* Extract the arguments and environment as encoded on the stack.  The
      argument info starts after one register window (16 words) past the SP.  */
-       ld      [%sp+22*4], %o0
-       add     %sp, 23*4, %o1
-       sll     %o0, 2, %o2
-       add     %o2, %o1, %o2
-       sethi   %hi(__environ), %g2
-       add     %o2, 4, %o2
-       st      %o2, [%g2+%lo(__environ)]
-
-       mov     %o0, %l0                /* tuck them away */
-       mov     %o1, %l1
-
-  /* Call _init, the entry point to our own .init section.  */
-       call    _init
-        mov    %o2, %l2
-
-  /* Register our .fini section with atexit.  */
-       sethi   %hi(_fini), %o0
-       call    atexit
-        add    %o0, %lo(_fini), %o0
-
-  /* Call the user's main and exit with its return value.  */
-       mov     %l0, %o0
-       mov     %l1, %o1
-       call    main
-        mov    %l2, %o2
-       call    exit
+       ld      [%sp+22*4], %o1
+       add     %sp, 23*4, %o2
+
+  /* Load the addresses of the user entry points.  */
+       sethi   %hi(main), %o0
+       sethi   %hi(_init), %o3
+       sethi   %hi(_fini), %o4
+       or      %o0, %lo(main), %o0
+       or      %o3, %lo(_init), %o3
+       or      %o4, %lo(_fini), %o4
+
+  /* When starting a binary via the dynamic linker, %g1 contains the
+     address of the shared library termination function, which will be
+     registered with atexit().  If we are statically linked, this will
+     be NULL.  */
+       mov     %g1, %o5
+
+  /* Let libc do the rest of the initialization, and call main.  */
+       call    __libc_start_main
         nop
 
   /* Die very horribly if exit returns.  */
        unimp
 
-       .size _start,.-_start
+       .size _start, .-_start
index 73f42367eed5c288e90f2dabc055bbab43d7c624..140cd366e502b526538a97d3471f9d89b131f28e 100644 (file)
@@ -1,5 +1,5 @@
 /* Startup code for elf64-sparc
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
        .type _start,#function
 _start:
 
-  /* First order of business is to load %g4 with our base address.  */
-       sethi   %uhi(_start), %g4
-       or      %g4, %ulo(_start), %g4
-       sllx    %g4, 32, %g4
-
   /* Terminate the stack frame, and reserve space for functions to
      drop their arguments.  */
        mov     %g0, %fp
        sub     %sp, 6*8, %sp
 
-  /* Save %g1.  When starting a binary via the dynamic linker, %g1
-     contains the address of the shared library termination function,
-     which we will register below with atexit() to be called by exit().
-     If we are statically linked, this will be NULL.  */
-
-  /* Do essential libc initialization (sp points to argc, argv, and envp)  */
-       call    __libc_init_first
-        mov    %g1, %l0
-
-  /* Now that we have the proper stack frame, register library termination
-     function, if there is any:  */
-
-       brz,pn  %l0, 1f
-        nop
-       call    atexit
-        mov    %l0, %o0
-1:
-
   /* Extract the arguments and environment as encoded on the stack.  The
      argument info starts after one register window (16 words) past the SP,
      plus the bias we added, plus the magic v9 STACK_BIAS.  */
-       ldx     [%sp+STACK_BIAS+22*8], %o0
-       add     %sp, STACK_BIAS+23*8, %o1
-       sllx    %o0, 3, %o2
-       add     %o2, %o1, %o2
-       sethi   %hi(__environ), %g2
-       add     %o2, 8, %o2
-       add     %g2, %g4, %g2
-       stx     %o2, [%g2+%lo(__environ)]
-
-       mov     %o0, %l0                /* tuck them away */
-       mov     %o1, %l1
-
-  /* Call _init, the entry point to our own .init section.  */
-       call    _init
-        mov    %o2, %l2
-
-  /* Register our .fini section with atexit.  */
-       sethi   %hi(_fini), %o0
-       add     %o0, %g4, %o0
-       call    atexit
-        add    %o0, %lo(_fini), %o0
-
-  /* Call the user's main and exit with its return value.  */
-       mov     %l0, %o0
-       mov     %l1, %o1
-       call    main
-        mov    %l2, %o2
-       call    exit
+       ldx     [%sp+STACK_BIAS+22*8], %o1
+       add     %sp, STACK_BIAS+23*8, %o2
+
+  /* Load the addresses of the user entry points.  */
+        sethi   %uhi(main), %o0
+        sethi   %uhi(_init), %o3
+        sethi   %uhi(_fini), %o4
+        or      %o0, %ulo(main), %o0
+        or      %o3, %ulo(_init), %o3
+        or      %o4, %ulo(_fini), %o4
+        sethi   %hi(main), %i0
+        sethi   %hi(_init), %i3
+        sethi   %hi(_fini), %i4
+       sllx    %o0, 32, %o0
+        or      %i0, %lo(main), %i0
+       sllx    %o3, 32, %o3
+        or      %i3, %lo(_init), %i3
+       sllx    %o4, 32, %o4
+        or      %i4, %lo(_fini), %i4
+       or      %o0, %i0, %o0
+       or      %o3, %i3, %o3
+       or      %o4, %i4, %o4
+
+  /* When starting a binary via the dynamic linker, %g1 contains the
+     address of the shared library termination function, which will be
+     registered with atexit().  If we are statically linked, this will
+     be NULL.  */
+       mov     %g1, %o5
+
+  /* Let libc do the rest of the initialization, and call main.  */
+       call    __libc_start_main
         nop
 
   /* Die very horribly if exit returns.  */
        illtrap 0
 
-       .size _start,.-_start
+       .size _start, .-_start