]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix PIC case.
authorUlrich Drepper <drepper@redhat.com>
Sat, 12 Jul 1997 23:28:11 +0000 (23:28 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 12 Jul 1997 23:28:11 +0000 (23:28 +0000)
sysdeps/mips/bsd-_setjmp.S
sysdeps/mips/bsd-setjmp.S
sysdeps/mips/elf/start.S
sysdeps/mips/setjmp.S
sysdeps/unix/mips/brk.S
sysdeps/unix/mips/sysdep.S
sysdeps/unix/mips/sysdep.h
sysdeps/unix/mips/wait.S

index f519f1935929c6d0abd3cc6ad3e8424d20c22bbf..819a7018c4d47e3cda2dee56e706b2785f348766 100644 (file)
 
 #include <sysdep.h>
 
+/* XXX Must this be __PIC__ ? --drepper */
 #ifdef PIC
        .option pic2
 #endif
 ENTRY (_setjmp)
+       .set noreorder
 #ifdef PIC
        .cpload t9
+       la      t9, C_SYMBOL_NAME (__sigsetjmp)
+       jr      t9
+#else
+       j       C_SYMBOL_NAME (__sigsetjmp)
 #endif
-       la t9, C_SYMBOL_NAME (__sigsetjmp)
-       nop
-       jr t9
-       li a1, 0                /* Pass a second argument of zero.  */
+       move    a1,zero         /* Pass a second argument of zero.  */
+       .set    reorder
+       .end    _setjmp
index 9a22700718a39fcf1d52a790eed062e8b8453ad5..f220404c2c4d58e4d90987d810031180f6a6961a 100644 (file)
 
 #include <sysdep.h>
 
+/* XXX Must this be __PIC__ ? --drepper */
 #ifdef PIC
        .option pic2
 #endif
 ENTRY (setjmp)
+       .set    noreorder
 #ifdef PIC
        .cpload t9
+       la      t9, C_SYMBOL_NAME (__sigsetjmp)
+       jr      t9
+#else
+       j       C_SYMBOL_NAME (__sigsetjmp)
 #endif
-       la t9, C_SYMBOL_NAME (__sigsetjmp)
-       nop
-       jr t9
-       li a1, 1                /* Pass a second argument of one.  */
+       li      a1, 1           /* Pass a second argument of one.  */
+       .set    reorder
+       .end    setjmp
index 355a4a905ca51467f4f6554925059d53261a3c15..ce9ad9c7ec8e3322bad2e47e3e87dae05fcbc0fc 100644 (file)
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <entry.h>
+
+#ifndef ENTRY_POINT
+#error ENTRY_POINT needs to be defined for start.S on MIPS/ELF.
+#endif
+
 /* This is the canonical entry point, usually the first thing in the text
    segment.  The SVR4/Mips ABI (pages 3-31, 3-32) says that when the entry
    point runs, most registers' values are unspecified, except for:
@@ -53,8 +59,8 @@
 #endif
 
        .text
-       .globl _start
-_start:
+       .globl ENTRY_POINT
+ENTRY_POINT:
 #ifdef PIC
        SET_GP
 #endif
@@ -81,20 +87,9 @@ nofini:
           the prologue of __libc_init_first, we preload them to
           prevent clobbering the stack tops. In Hurd case, stack pointer
           ($29) may be VM_MAX_ADDRESS here. If so, we must modify it.  */
-#if (__mips64)
-       dli $4, 0x10000000000
-       bne $29, $4, 1f
-       dsubu $29, 32
-       sd $0, 0($29)
-       sd $0, 8($29)
-       sd $0, 16($29)
-       sd $0, 24($29)
-1:
-       ld $4, 0($29)
-       ld $5, 8($29)
-       ld $6, 16($29)
-       ld $7, 24($29)
-#else  /* __mips64 */
+#if 0
+       jal mach_host_self
+#endif
        li $4, 0x80000000
        bne $29, $4, 1f
        subu $29, 16
@@ -107,23 +102,14 @@ nofini:
        lw $5, 4($29)
        lw $6, 8($29)
        lw $7, 12($29)
-#endif  /* __mips64 */
-
        jal __libc_init_first
 #ifdef PIC
        SET_GP
 #endif
-#if (__mips64)
-       ld $4, 0($29)
-       ld $5, 8($29)
-       ld $6, 16($29)
-       ld $7, 24($29)
-#else  /* __mips64 */
        lw $4, 0($29)
        lw $5, 4($29)
        lw $6, 8($29)
        lw $7, 12($29)
-#endif  /* __mips64 */
 
        /* Call `_init', which is the entry point to our own `.init'
           section; and register with `atexit' to have `exit' call
@@ -145,19 +131,11 @@ nofini:
 
        /* Extract the arguments and environment as encoded on the stack
           and set up the arguments for `main': argc, argv, envp.  */
-#if (__mips64)
-       ld $4, 0($29)           /* argc */
-       daddu $5, $29, 8        /* argv */
-       dsll $6, $4, 3
-       daddu $6, $6, 8
-       daddu $6, $5, $6        /* envp = &argv[argc + 1] */
-#else  /* __mips64 */
        lw $4, 0($29)           /* argc */
        addu $5, $29, 4         /* argv */
        sll $6, $4, 2
        addu $6, $6, 4
        addu $6, $5, $6         /* envp = &argv[argc + 1] */
-#endif  /* __mips64 */
 
        /* Call the user's main function, and exit with its value.  */
        jal main
@@ -172,10 +150,11 @@ hlt:      b hlt                   /* Crash if somehow it does return.  */
        .data
        .globl __data_start
 __data_start:
-#if (__mips64)
-       .dword 0
-#else  /* __mips64 */
-       .word 0
-#endif  /* __mips64 */
+       .long 0
        .weak data_start
        data_start = __data_start
+
+       .comm errno, 4, 4
+#ifdef __ELF__
+       .type errno, @object
+#endif
index bc42dcb03bacd0c11d287d13d2829523ca8c6fdb..607b5f268d92cb1362a5ea87e187491b908728a7 100644 (file)
 #endif
 ENTRY (__sigsetjmp)
 #ifdef PIC
-       .cpload t9
+       .set    noreorder
+       .cpload t9
+       .set    reorder
 #endif
-       move a2, sp
-       move a3, fp
-       la t9, __sigsetjmp_aux
-       nop
-       jr t9
+       move    a2, sp
+#ifdef fp
+       move    a3, fp
+#else
+       move    a3, $fp
+#endif
+#ifdef PIC
+       la      t9, __sigsetjmp_aux
+       jr      t9
+#else
+       j       __sigsetjmp_aux
+#endif
+       .end __sigsetjmp
index 197672669bf0a5496c7d59ff427610b5b65f4811..e38f735b9277b093eab790744a9155cb1389ac45 100644 (file)
 #endif
 
 #ifndef       HAVE_GNU_LD
-#define __end           end
+#define _end           end
 #endif
 
-.data
-.sdata
+       .data
 ENTRY(__curbrk)
-       .word __end
+       .word 0
        .end __curbrk
-.text
-.set noreorder
-.set noat
 
-ENTRY(__brk)
-       /* Minimum is one page.  */
-       lui v0, 4096
-       lw v0, __end
-       nop
-
-       /* If they ask for less than a page, givvem the whole
-          thing anyway.  */
-       sltu AT, a0, v0
-       beq AT, zero, down1
-       nop
-       move a0, v0
-down1:
-       li v0, SYS_brk
-       syscall
-       bne a3, zero, error
-
-       /* Update __curbrk and exit cleanly.  */
-       lui AT, 4096
+       .text
+SYSCALL__(brk, 1)
+       .set    reorder
+       /* Handle the query case.  */
+       bnez a0, 1f
+       move a0,v0
+1:     /* Update __curbrk and exit cleanly.  */
        sw a0, __curbrk
-       j ra
        move v0, zero
-
-       /* What a horrible way to die.  */
-error: j syscall_error
-       nop
-       nop
-       nop
+       jr ra
        .end __brk
 
 weak_alias (__brk, brk)
index 0cfc30277034c5f01e5094c31e15a9374674102f..ac8335fe5b443b7b33ba96304ebbe27c2c9091ba 100644 (file)
 #define _ERRNO_H
 #include <bits/errno.h>
 
-/* .globl errno */
-.set noreorder
+       .comm errno, 4
+#ifdef __ELF__
+       .type errno, @object
+#endif
+
+       .set noreorder
 
-ENTRY(syscall_error)
+ENTRY(__syscall_error)
+#ifdef __PIC__
+       .set    noat
+       move    $1, $31
+       bltzal  $0, 0f
+       nop
+0:     .cpload $31
+       move    $31, $1
+       .set    at
+#endif
 #if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
        /* We translate the system's EWOULDBLOCK error into EAGAIN.
           The GNU C library always defines EWOULDBLOCK==EAGAIN.
@@ -40,4 +53,8 @@ skip:
        /* And just kick back a -1.  */
        j ra
        li v0, -1
-       .end syscall_error
+       END(__syscall_error)
+
+/* We provide this alias for compatilility with other Unices
+   like IRIX 5  */
+weak_alias (__syscall_error, syscall_error)
index 2f148d093801624ddf81520a3a46a364b776389d..cbafbdcd9ac28f10ef2032211616054c7a7413a2 100644 (file)
 /* Note that while it's better structurally, going back to call syscall_error
    can make things confusing if you're debugging---it looks like it's jumping
    backwards into the previous fn.  */
+#ifdef __PIC__
+ #define PSEUDO(name, syscall_name, args) \
+  .align 2;                                                                  \
+  99: la t9,syscall_error;                                                   \
+  jr t9;                                                                     \
+  ENTRY(name)                                                                \
+  .set noreorder;                                                            \
+  .cpload t9;                                                                \
+  li v0, SYS_##syscall_name;                                                 \
+  syscall;                                                                   \
+  .set reorder;                                                                      \
+  bne a3, zero, 99b;                                                         \
+syse1:
+#else
 #define PSEUDO(name, syscall_name, args) \
   .set noreorder;                                                            \
   .align 2;                                                                  \
   99: j syscall_error;                                                       \
-  nop;                                                                       \
   ENTRY(name)                                                                \
+  .set noreorder;                                                            \
   li v0, SYS_##syscall_name;                                                 \
   syscall;                                                                   \
+  .set reorder;                                                                      \
   bne a3, zero, 99b;                                                         \
-  nop;                                                                       \
 syse1:
+#endif
+
+#undef PSEUDO_END
+#define PSEUDO_END(sym) .end sym
 
 #define ret    j ra ; nop
+
+#undef END
+#define END(sym)        .end sym
+
 #define r0     v0
 #define r1     v1
 /* The mips move insn is d,s.  */
index a544156c4eadbae6129c7f5f10dfab9595c0cfa6..9ea55bc7d0f444e9cd049951daf1675786b77b01 100644 (file)
@@ -28,14 +28,14 @@ ENTRY(__wait)
 
        li v0, SYS_wait
        syscall
-       beq a3, zero, noerror
+       beqz a3, noerror
        nop
-       j syscall_error
+       j __syscall_error
        nop
 
 noerror:
        /* If the arg is not NULL, store v1 there.  */
-       beq a0, zero, noarg
+       beqz a0, noarg
        nop
        sw v1, 0(a0)
        nop