about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/m68k/bsd-_setjmp.S2
-rw-r--r--sysdeps/m68k/bsd-setjmp.S2
-rw-r--r--sysdeps/m68k/dl-machine.h27
-rw-r--r--sysdeps/unix/closedir.c6
-rw-r--r--sysdeps/unix/dirstream.h7
-rw-r--r--sysdeps/unix/opendir.c26
-rw-r--r--sysdeps/unix/readdir.c4
-rw-r--r--sysdeps/unix/seekdir.c6
-rw-r--r--sysdeps/unix/telldir.c4
9 files changed, 50 insertions, 34 deletions
diff --git a/sysdeps/m68k/bsd-_setjmp.S b/sysdeps/m68k/bsd-_setjmp.S
index 69aa7de04c..db777cf67d 100644
--- a/sysdeps/m68k/bsd-_setjmp.S
+++ b/sysdeps/m68k/bsd-_setjmp.S
@@ -23,7 +23,7 @@ Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
 
-#ifdef MOTOROLA_SYNTAX
+#if defined (MOTOROLA_SYNTAX) || defined (ELF_SYNTAX)
 #define d0 %d0
 #define d1 %d1
 #define PUSH(reg)	move.l reg, -(%sp)
diff --git a/sysdeps/m68k/bsd-setjmp.S b/sysdeps/m68k/bsd-setjmp.S
index c853516824..c1794978bc 100644
--- a/sysdeps/m68k/bsd-setjmp.S
+++ b/sysdeps/m68k/bsd-setjmp.S
@@ -23,7 +23,7 @@ Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
 
-#ifdef MOTOROLA_SYNTAX
+#if defined (MOTOROLA_SYNTAX) || defined (ELF_SYNTAX)
 #define d0 %d0
 #define d1 %d1
 #define PUSH(reg)	move.l reg, -(%sp)
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index 2208cd2259..8cbb97787c 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -52,9 +52,22 @@ elf_machine_got (void)
 static inline Elf32_Addr
 elf_machine_load_address (void)
 {
-  ...
+  Elf32_Addr addr;
+  asm ("here:	lea here(%%pc), %0\n"
+       "	sub.l %#here, %0"
+       : "=a" (addr));
+  return addr;
 }
 
+/* The `subl' insn above will contain an R_68K_RELATIVE relocation
+   entry intended to insert the run-time address of the label `here'.
+   This will be the first relocation in the text of the dynamic
+   linker; we skip it to avoid trying to modify read-only text in this
+   early stage.  */
+#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \
+  ((dynamic_info)[DT_RELA]->d_un.d_ptr += sizeof (Elf32_Rela), \
+   (dynamic_info)[DT_RELASZ]->d_un.d_val -= sizeof (Elf32_Rela))
+
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
 
@@ -158,11 +171,13 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
 	.globl _dl_runtime_resolve
 	.type _dl_runtime_resolve, @function
 _dl_runtime_resolve:
-	| Save %a0 (struct return address).
+	| Save %a0 (struct return address) and %a1.
 	move.l %a0, -(%sp)
+	move.l %a1, -(%sp)
 	| Call the real address resolver.
-	bsr.l fixup
-	| Restore register %a0.
+	jbsr fixup
+	| Restore register %a0 and %a1.
+	move.l (%sp)+, %a1
 	move.l (%sp)+, %a0
 	| Pop parameters
 	addq.l #8, %sp
@@ -170,7 +185,9 @@ _dl_runtime_resolve:
 	jmp (%d0)
 	.size _dl_runtime_resolve, . - _dl_runtime_resolve
 ");
-#define ELF_MACHINE_RUNTIME_FIXUP_ARGS long int save_a0
+#define ELF_MACHINE_RUNTIME_FIXUP_ARGS long int save_a0, long int save_a1
+/* The PLT uses Elf32_Rela relocs.  */
+#define elf_machine_relplt elf_machine_rela
 }
 
 
diff --git a/sysdeps/unix/closedir.c b/sysdeps/unix/closedir.c
index 5f1ac7439a..6acbb62e87 100644
--- a/sysdeps/unix/closedir.c
+++ b/sysdeps/unix/closedir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -37,9 +37,9 @@ DEFUN(closedir, (dirp), DIR *dirp)
       return -1;
     }
 
-  fd = dirp->__fd;
+  fd = dirp->fd;
 
-  free ((PTR) dirp->__data);
+  free ((PTR) dirp->data);
   free ((PTR) dirp);
 
   return __close (fd);
diff --git a/sysdeps/unix/dirstream.h b/sysdeps/unix/dirstream.h
index 72fd67c722..52d2337125 100644
--- a/sysdeps/unix/dirstream.h
+++ b/sysdeps/unix/dirstream.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -20,8 +20,7 @@ Cambridge, MA 02139, USA.  */
 
 #define	_DIRSTREAM_H	1
 
-#define __need_size_t
-#include <stddef.h>
+#include <sys/types.h>
 
 /* Directory stream type.
 
@@ -37,7 +36,7 @@ struct __dirstream
     size_t __offset;		/* Current offset into the block.  */
     size_t __size;		/* Total valid data in the block.  */
 
-    struct dirent __entry;	/* Returned by `readdir'.  */
+    off_t pos;			/* Position of next entry to read.  */
   };
 
 #define _DIR_dirfd(dirp)	((dirp)->__fd)
diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c
index 5cd620676a..31111e8c50 100644
--- a/sysdeps/unix/opendir.c
+++ b/sysdeps/unix/opendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
-#include <ansidecl.h>
 #include <errno.h>
 #include <limits.h>
 #include <stddef.h>
@@ -28,12 +27,11 @@ Cambridge, MA 02139, USA.  */
 #include <unistd.h>
 #include <stdio.h>
 
-#include "direct.h"		/* This file defines `struct direct'.  */
 #include "dirstream.h"
 
 /* Open a directory stream on NAME.  */
 DIR *
-DEFUN(opendir, (name), CONST char *name)
+opendir (const char *name)
 {
   DIR *dirp;
   struct stat statbuf;
@@ -62,7 +60,7 @@ DEFUN(opendir, (name), CONST char *name)
       goto lose;
     }
 
-  dirp = (DIR *) calloc (1, sizeof (DIR) + NAME_MAX); /* Zero-fill.  */
+  dirp = (DIR *) calloc (1, sizeof (DIR)); /* Zero-fill.  */
   if (dirp == NULL)
   lose:
     {
@@ -73,24 +71,24 @@ DEFUN(opendir, (name), CONST char *name)
     }
 
 #ifdef _STATBUF_ST_BLKSIZE
-  if (statbuf.st_blksize < sizeof (struct direct))
-    dirp->__allocation = sizeof (struct direct);
+  if (statbuf.st_blksize < sizeof (struct dirent))
+    dirp->allocation = sizeof (struct dirent);
   else
-    dirp->__allocation = statbuf.st_blksize;
+    dirp->allocation = statbuf.st_blksize;
 #else
-  dirp->__allocation = (BUFSIZ < sizeof (struct direct) ?
-			sizeof (struct direct) : BUFSIZ);
+  dirp->allocation = (BUFSIZ < sizeof (struct dirent) ?
+		      sizeof (struct dirent) : BUFSIZ);
 #endif
-  dirp->__data = (char *) malloc (dirp->__allocation);
-  if (dirp->__data == NULL)
+  dirp->data = (char *) malloc (dirp->allocation);
+  if (dirp->data == NULL)
     {
       int save = errno;
-      free ((PTR) dirp);
+      free (dirp);
       (void) __close (fd);
       errno = save;
       return NULL;
     }
 
-  dirp->__fd = fd;
+  dirp->fd = fd;
   return dirp;
 }
diff --git a/sysdeps/unix/readdir.c b/sysdeps/unix/readdir.c
index 1842948a35..b1d7e43231 100644
--- a/sysdeps/unix/readdir.c
+++ b/sysdeps/unix/readdir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -77,6 +77,8 @@ DEFUN(readdir, (dirp), DIR *dirp)
 	  p = memchr ((PTR) dp->d_name, '\0', D_NAMLEN (dp) + 1);
 	  d->d_namlen = (p != NULL) ? p - dp->d_name : D_NAMLEN (dp);
 	  memcpy (d->d_name, dp->d_name, d->d_namlen + 1);
+	  d->d_type = DT_UNKNOWN;
+	  d->d_reclen = &d->d_name[d->d_namlen + 1] - (char *) d;
 	  return d;
 	}
     }
diff --git a/sysdeps/unix/seekdir.c b/sysdeps/unix/seekdir.c
index 018f697c21..02390d7854 100644
--- a/sysdeps/unix/seekdir.c
+++ b/sysdeps/unix/seekdir.c
@@ -27,7 +27,7 @@ Cambridge, MA 02139, USA.  */
 void
 DEFUN(seekdir, (dirp, pos), DIR *dirp AND __off_t pos)
 {
-  (void) __lseek(dirp->__fd, pos, SEEK_SET);
-  dirp->__size = 0;
-  dirp->__offset = 0;
+  (void) __lseek(dirp->fd, pos, SEEK_SET);
+  dirp->size = 0;
+  dirp->offset = 0;
 }
diff --git a/sysdeps/unix/telldir.c b/sysdeps/unix/telldir.c
index 2b611b0fca..c319d71df7 100644
--- a/sysdeps/unix/telldir.c
+++ b/sysdeps/unix/telldir.c
@@ -36,8 +36,8 @@ DEFUN(telldir, (dirp), DIR *dirp)
       return (off_t) -1;
     }
 
-  pos = __lseek(dirp->__fd, (off_t) 0, SEEK_CUR);
+  pos = __lseek(dirp->fd, (off_t) 0, SEEK_CUR);
   if (pos == (off_t) -1)
     return (off_t) -1;
-  return pos + dirp->__size - dirp->__offset;
+  return pos + dirp->size - dirp->offset;
 }