summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--csu/initfini.c16
-rw-r--r--intl/l10nflist.c17
-rw-r--r--sysdeps/m68k/dl-machine.h204
-rw-r--r--sysdeps/unix/inet/syscalls.list4
4 files changed, 122 insertions, 119 deletions
diff --git a/csu/initfini.c b/csu/initfini.c
index e4a7117130..6b12850a24 100644
--- a/csu/initfini.c
+++ b/csu/initfini.c
@@ -57,6 +57,15 @@ rm -f crti.s-new crtn.s-new\n\
 mv crtcommon.tmp crti.s-new\n\
 cp crti.s-new crtn.s-new");
 
+/* Extract a `.end' if one is produced by the compiler.  */
+asm ("fgrep .end >/dev/null 2>&1 <<\\EOF.end && need_end=yes");
+void
+useless_function (void)
+{
+  return;
+}
+asm ("\nEOF.end\n");
+
 /* Append the .init prologue to crti.s-new.  */
 asm ("cat >> crti.s-new <<\\EOF.crti.init");
 
@@ -77,8 +86,9 @@ _init (void)
   /* End the here document containing the .init prologue code.
      Then fetch the .section directive just written and append that
      to crtn.s-new, followed by the function epilogue.  */
-  asm (".end _init\n\
+  asm ("\n\
 EOF.crti.init\n\
+	test -n \"$need_end\" && echo .end _init >> crti.s-new\n\
 	fgrep .init crti.s-new >>crtn.s-new\n\
 	fgrep -v .end >> crtn.s-new <<\\EOF.crtn.init");
 }
@@ -96,8 +106,8 @@ _fini (void)
   /* End the here document containing the .fini prologue code.
      Then fetch the .section directive just written and append that
      to crtn.s-new, followed by the function epilogue.  */
-  asm (".end _fini\n\
-EOF.crti.fini\n\
+  asm ("\nEOF.crti.fini\n\
+test -n \"$need_end\" && echo .end _fini >> crti.s-new\n\
 cat > /dev/null <<\\EOF.fini.skip");
 
   {
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index cfead52561..846465bffe 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -23,14 +23,6 @@ Cambridge, MA 02139, USA.  */
 # include <config.h>
 #endif
 
-#if defined _LIBC || defined HAVE_ARGZ_H
-# include <argz.h>
-#endif
-#include <ctype.h>
-
-#if defined STDC_HEADERS || defined _LIBC
-# include <stdlib.h>
-#endif
 
 #if defined HAVE_STRING_H || defined _LIBC
 # ifndef _GNU_SOURCE
@@ -46,6 +38,15 @@ Cambridge, MA 02139, USA.  */
 # endif
 #endif
 
+#if defined _LIBC || defined HAVE_ARGZ_H
+# include <argz.h>
+#endif
+#include <ctype.h>
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#endif
+
 #include "loadinfo.h"
 
 /* On some strange systems still no definition of NULL is found.  Sigh!  */
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index a11ff237ad..0cb0b34f35 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -17,12 +17,12 @@ 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.  */
 
+#ifndef dl_machine_h
+#define dl_machine_h
+
 #define ELF_MACHINE_NAME "m68k"
 
 #include <assert.h>
-#include <string.h>
-#include <link.h>
-
 
 /* Return nonzero iff E_MACHINE is compatible with the running host.  */
 static inline int
@@ -68,109 +68,6 @@ elf_machine_load_address (void)
   ((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.  */
-
-static inline void
-elf_machine_rela (struct link_map *map,
-		  const Elf32_Rela *reloc, const Elf32_Sym *sym,
-		  Elf32_Addr (*resolve) (const Elf32_Sym **ref,
-					 Elf32_Addr reloc_addr,
-					 int noplt))
-{
-  Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
-  Elf32_Addr loadbase;
-
-#ifdef RTLD_BOOTSTRAP
-#define RESOLVE(noplt) map->l_addr
-#else
-#define RESOLVE(noplt) (*resolve) (&sym, (Elf32_Addr) reloc_addr, noplt)
-#endif
-
-  switch (ELF32_R_TYPE (reloc->r_info))
-    {
-    case R_68K_COPY:
-      loadbase = RESOLVE (0);
-      memcpy (reloc_addr, (void *) (loadbase + sym->st_value), sym->st_size);
-      break;
-    case R_68K_GLOB_DAT:
-      loadbase = RESOLVE (0);
-      *reloc_addr = sym ? (loadbase + sym->st_value) : 0;
-      break;
-    case R_68K_JMP_SLOT:
-      loadbase = RESOLVE (1);
-      *reloc_addr = sym ? (loadbase + sym->st_value) : 0;
-      break;
-    case R_68K_8:
-      loadbase = RESOLVE (0);
-      *(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-			      + reloc->r_addend);
-      break;
-    case R_68K_16:
-      loadbase = RESOLVE (0);
-      *(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-			       + reloc->r_addend);
-      break;
-    case R_68K_32:
-      loadbase = RESOLVE (0);
-      *reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-		     + reloc->r_addend);
-      break;
-    case R_68K_RELATIVE:
-      *reloc_addr = map->l_addr + reloc->r_addend;
-      break;
-    case R_68K_PC8:
-      loadbase = RESOLVE (0);
-      *(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-			      + reloc->r_addend
-			      - (Elf32_Addr) reloc_addr);
-      break;
-    case R_68K_PC16:
-      loadbase = RESOLVE (0);
-      *(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-			       + reloc->r_addend
-			       - (Elf32_Addr) reloc_addr);
-      break;
-    case R_68K_PC32:
-      loadbase = RESOLVE (0);
-      *reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
-		     + reloc->r_addend
-		     - (Elf32_Addr) reloc_addr);
-      break;
-    case R_68K_NONE:		/* Alright, Wilbur.  */
-      break;
-    default:
-      assert (! "unexpected dynamic reloc type");
-      break;
-    }
-
-#undef RESOLVE
-}
-
-static inline void
-elf_machine_lazy_rel (struct link_map *map, const Elf32_Rela *reloc)
-{
-  Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
-  switch (ELF32_R_TYPE (reloc->r_info))
-    {
-    case R_68K_NONE:
-      break;
-    case R_68K_JMP_SLOT:
-      *reloc_addr += map->l_addr;
-      break;
-    default:
-      assert (! "unexpected PLT reloc type");
-      break;
-    }
-}
-
-/* Nonzero iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.  */
-#define elf_machine_pltrel_p(type) ((type) == R_68K_JMP_SLOT)
-
-/* The m68k never uses Elf32_Rel relocations.  */
-#define ELF_MACHINE_NO_REL 1
-
 
 /* Set up the loaded object described by L so its unrelocated PLT
    entries will jump to the on-demand fixup code in dl-runtime.c.  */
@@ -283,3 +180,98 @@ _dl_start_user:
 	move.l %sp, %fp
 	| Jump to the user's entry point.
 	jmp (%a4)");
+
+/* Nonzero iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.  */
+#define elf_machine_pltrel_p(type) ((type) == R_68K_JMP_SLOT)
+
+/* The m68k never uses Elf32_Rel relocations.  */
+#define ELF_MACHINE_NO_REL 1
+
+#endif /* !dl_machine_h */
+
+#ifdef RESOLVE
+
+/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
+   MAP is the object containing the reloc.  */
+
+static inline void
+elf_machine_rela (struct link_map *map,
+		  const Elf32_Rela *reloc, const Elf32_Sym *sym)
+{
+  Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
+  Elf32_Addr loadbase;
+
+  switch (ELF32_R_TYPE (reloc->r_info))
+    {
+    case R_68K_COPY:
+      loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
+      memcpy (reloc_addr, (void *) (loadbase + sym->st_value), sym->st_size);
+      break;
+    case R_68K_GLOB_DAT:
+      loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
+      *reloc_addr = sym ? (loadbase + sym->st_value) : 0;
+      break;
+    case R_68K_JMP_SLOT:
+      loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 1);
+      *reloc_addr = sym ? (loadbase + sym->st_value) : 0;
+      break;
+    case R_68K_8:
+      loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
+      *(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+			      + reloc->r_addend);
+      break;
+    case R_68K_16:
+      loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
+      *(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+			       + reloc->r_addend);
+      break;
+    case R_68K_32:
+      loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
+      *reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+		     + reloc->r_addend);
+      break;
+    case R_68K_RELATIVE:
+      *reloc_addr = map->l_addr + reloc->r_addend;
+      break;
+    case R_68K_PC8:
+      loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
+      *(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+			      + reloc->r_addend - (Elf32_Addr) reloc_addr);
+      break;
+    case R_68K_PC16:
+      loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
+      *(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+			       + reloc->r_addend - (Elf32_Addr) reloc_addr);
+      break;
+    case R_68K_PC32:
+      loadbase = RESOLVE (&sym, (Elf32_Addr) reloc_addr, 0);
+      *reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
+		     + reloc->r_addend - (Elf32_Addr) reloc_addr);
+      break;
+    case R_68K_NONE:		/* Alright, Wilbur.  */
+      break;
+    default:
+      assert (! "unexpected dynamic reloc type");
+      break;
+    }
+
+#undef RESOLVE
+}
+
+static inline void
+elf_machine_lazy_rel (struct link_map *map, const Elf32_Rela *reloc)
+{
+  Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
+  switch (ELF32_R_TYPE (reloc->r_info))
+    {
+    case R_68K_JMP_SLOT:
+      *reloc_addr += map->l_addr;
+      break;
+    default:
+      assert (! "unexpected PLT reloc type");
+      break;
+    }
+}
+
+#endif /* RESOLVE */
diff --git a/sysdeps/unix/inet/syscalls.list b/sysdeps/unix/inet/syscalls.list
index 661a8433f5..976cc1892c 100644
--- a/sysdeps/unix/inet/syscalls.list
+++ b/sysdeps/unix/inet/syscalls.list
@@ -2,7 +2,7 @@
 
 accept		-	accept		3	accept
 bind		-	bind		3	bind
-__connect	-	connect		3	connect		connect
+connect		-	connect		3	__connect	connect
 gethostid	-	gethostid	0	gethostid
 gethostname	-	gethostname	2	__gethostname	gethostname
 getpeername	-	getpeername	3	getpeername
@@ -12,7 +12,7 @@ listen		-	listen		2	listen
 recv		-	recv		4	recv
 recvfrom	-	recvfrom	6	recvfrom
 recvmsg		-	recvmsg		3	recvmsg
-__send		-	send		4	send		send
+send		-	send		4	__send		send
 sendmsg		-	sendmsg		3	sendmsg
 sendto		-	sendto		6	sendto
 sethostid	-	sethostid	1	sethostid