This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

mips64 n32 and n64 suport in elf/


This patch introduces support for the N32 and N64 ABIs in the elf/
directory, with a small sysdeps/generic change required as well.

It includes a patch I had posted earlier, that disables
dl_resolve_conflicts() when there's no RELA support, along with the
corresponding patch in rtld.c that removes the tests for prelinked
binaries when RELA is not supported.  I don't see any way to do
prelinking work with REL, anyway, since the addend takes up the very
location where we could possibly store the prelinked addresses.  That
said, Irix certainly does some magic like that with its Quickstart
feature, but I don't know the details, and we don't support that now
anyway.

The patch also introduces macros that are used to support the
ABI-specified LD_LIBRARYN32_PATH and LD_LIBRARY64_PATH environment
variables.

I can break this up into 2 or 3 separate patches, if preferred.
Otherwise, ok to install?

Index: ChangeLog
2003-03-14  Alexandre Oliva  <aoliva at redhat dot com>

	* sysdeps/generic/ldconfig.h (FLAG_MIPS64_LIBN32,
	FLAG_MIPS64_LIBN64): Define.
	* elf/cache.c (print_entry): Handle mips64 n32 and n64.
	* elf/dl-conflict.c: Don't compile _dl_resolve_conflicts if
	ELF_MACHINE_NO_RELA is set.
	* elf/rtld.c (dl_main): No prelink support for REL-only.
	(process_envvars): Handle EXTRA_LD_PROCESS_ENVVARS_DECLS,
	EXTRA_LD_LEN14_ENVVARS and EXTRA_LD_AFTER_PROCESS_ENVVARS.

Index: sysdeps/generic/ldconfig.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/ldconfig.h,v
retrieving revision 1.5
diff -u -p -r1.5 ldconfig.h
--- sysdeps/generic/ldconfig.h 14 Sep 2002 09:00:28 -0000 1.5
+++ sysdeps/generic/ldconfig.h 14 Mar 2003 04:32:08 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj at suse dot de>, 1999.
 
@@ -32,6 +32,8 @@
 #define FLAG_X8664_LIB64	0x0300
 #define FLAG_S390_LIB64		0x0400
 #define FLAG_POWERPC_LIB64	0x0500
+#define FLAG_MIPS64_LIBN32	0x0600
+#define FLAG_MIPS64_LIBN64	0x0700
 
 /* Declared in cache.c.  */
 extern void print_cache (const char *cache_name);
Index: elf/cache.c
===================================================================
RCS file: /cvs/glibc/libc/elf/cache.c,v
retrieving revision 1.19
diff -u -p -r1.19 cache.c
--- elf/cache.c 29 Dec 2002 19:15:46 -0000 1.19
+++ elf/cache.c 14 Mar 2003 04:32:08 -0000
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj at suse dot de>, 1999.
 
@@ -86,6 +87,11 @@ print_entry (const char *lib, int flag, 
     case FLAG_POWERPC_LIB64:
       fputs(",64bit", stdout);
       break;
+    case FLAG_MIPS64_LIBN32:
+      fputs(",N32", stdout);
+      break;
+    case FLAG_MIPS64_LIBN64:
+      fputs(",64bit", stdout);
     case 0:
       break;
     default:
Index: elf/dl-conflict.c
===================================================================
RCS file: /cvs/glibc/libc/elf/dl-conflict.c,v
retrieving revision 1.8
diff -u -p -r1.8 dl-conflict.c
--- elf/dl-conflict.c 17 Oct 2002 12:09:48 -0000 1.8
+++ elf/dl-conflict.c 14 Mar 2003 04:32:08 -0000
@@ -1,5 +1,5 @@
 /* Resolve conflicts against already prelinked libraries.
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub at redhat dot com>, 2001.
 
@@ -28,7 +28,7 @@
 #include <sys/types.h>
 #include "dynamic-link.h"
 
-
+#if ! ELF_MACHINE_NO_RELA
 void
 _dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict,
 		       ElfW(Rela) *conflictend)
@@ -65,3 +65,4 @@ _dl_resolve_conflicts (struct link_map *
       elf_machine_rela (l, conflict, NULL, NULL, (void *) conflict->r_offset);
   }
 }
+#endif
Index: elf/rtld.c
===================================================================
RCS file: /cvs/glibc/libc/elf/rtld.c,v
retrieving revision 1.278
diff -u -p -r1.278 rtld.c
--- elf/rtld.c 7 Jan 2003 18:50:35 -0000 1.278
+++ elf/rtld.c 14 Mar 2003 04:32:10 -0000
@@ -1444,6 +1444,7 @@ cannot allocate TLS data structures for 
 	_dl_printf ("\nprelink checking: %s\n", prelinked ? "ok" : "failed");
     }
 
+#if ! ELF_MACHINE_NO_RELA /* We don't REL-only prelink.  */
   if (prelinked)
     {
       struct link_map *l;
@@ -1476,6 +1477,7 @@ cannot allocate TLS data structures for 
       _dl_sysdep_start_cleanup ();
     }
   else
+#endif
     {
       /* Now we have all the objects loaded.  Relocate them all except for
 	 the dynamic linker itself.  We do this in reverse order so that copy
@@ -1757,6 +1759,9 @@ process_envvars (enum mode *modep)
   char *envline;
   enum mode mode = normal;
   char *debug_output = NULL;
+#ifdef EXTRA_LD_PROCESS_ENVVARS_DECLS
+  EXTRA_LD_PROCESS_ENVVARS_DECLS
+#endif
 
   /* This is the default place for profiling data file.  */
   GL(dl_profile_output)
@@ -1865,6 +1870,12 @@ process_envvars (enum mode *modep)
 	      && memcmp (envline, "PROFILE_OUTPUT", 14) == 0
 	      && envline[15] != '\0')
 	    GL(dl_profile_output) = &envline[15];
+#ifdef EXTRA_LD_LEN14_ENVVARS
+	  else
+	    {
+	      EXTRA_LD_LEN14_ENVVARS
+	    }
+#endif
 	  break;
 
 	case 16:
@@ -1893,6 +1904,12 @@ process_envvars (enum mode *modep)
 #endif
 	}
     }
+
+#ifdef EXTRA_LD_AFTER_PROCESS_ENVVARS
+  {
+    EXTRA_LD_AFTER_PROCESS_ENVVARS
+  }
+#endif
 
   /* The caller wants this information.  */
   *modep = mode;
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist                Professional serial bug killer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]