This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: mips64 n32 and n64 suport in elf/
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Roland McGrath <roland at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: 14 Mar 2003 03:11:44 -0300
- Subject: Re: mips64 n32 and n64 suport in elf/
- Organization: GCC Team, Red Hat
- References: <200303140507.h2E57b009902@magilla.sf.frob.com>
On Mar 14, 2003, Roland McGrath <roland at redhat dot com> wrote:
>> (process_envvars): Handle EXTRA_LD_PROCESS_ENVVARS_DECLS,
>> EXTRA_LD_LEN14_ENVVARS and EXTRA_LD_AFTER_PROCESS_ENVVARS.
> After everything else is in, repost these with a little more explanation
> or comments in the code and showing how they're used.
Here's a separate patch, with additional comments for the macros,
along with their uses in n32 and n64-specific code.
Index: ChangeLog
2003-03-14 Alexandre Oliva <aoliva at redhat dot com>
* sysdeps/unix/sysv/linux/mips/mips64/n32/dl-librecon.h: New file.
* sysdeps/unix/sysv/linux/mips/mips64/n64/dl-librecon.h: New file.
* elf/rtld.c (process_envvars): Handle
EXTRA_LD_PROCESS_ENVVARS_DECLS, EXTRA_LD_LEN14_ENVVARS and
EXTRA_LD_AFTER_PROCESS_ENVVARS.
Index: sysdeps/unix/sysv/linux/mips/mips64/n32/dl-librecon.h
--- /dev/null 2002-10-04 15:48:04.000000000 -0300
+++ sysdeps/unix/sysv/linux/mips/mips64/n32/dl-librecon.h 2003-01-15 12:28:59.000000000 -0200
@@ -0,0 +1,40 @@
+/* Support alternate library paths.
+ Copyright 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Alexandre Oliva <aoliva at redhat dot com>, 2002.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _DL_LIBRECON_H
+#define _DL_LIBRECON_H 1
+
+#define EXTRA_LD_PROCESS_ENVVARS_DECLS \
+const char *libraryn32_path = 0;
+
+/* Recognize extra environment variables. */
+#define EXTRA_LD_ENVVARS \
+ case 15: \
+ if (memcmp (envline, "LIBRARYN32_PATH", 15) == 0) \
+ libraryn32_path = &envline[16]; \
+ break;
+
+#define EXTRA_LD_AFTER_PROCESS_ENVVARS \
+ if (libraryn32_path) \
+ library_path = libraryn32_path;
+
+#define EXTRA_UNSECURE_ENVVARS "LD_LIBRARYN32_PATH\0LD_LIBRARY64_PATH\0"
+
+#endif
Index: sysdeps/unix/sysv/linux/mips/mips64/n64/dl-librecon.h
--- /dev/null 2002-10-04 15:48:04.000000000 -0300
+++ sysdeps/unix/sysv/linux/mips/mips64/n64/dl-librecon.h 2003-01-15 12:28:59.000000000 -0200
@@ -0,0 +1,38 @@
+/* Support alternate library paths.
+ Copyright 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Alexandre Oliva <aoliva at redhat dot com>, 2002.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _DL_LIBRECON_H
+#define _DL_LIBRECON_H 1
+
+#define EXTRA_LD_PROCESS_ENVVARS_DECLS \
+const char *library64_path = 0;
+
+/* Recognize extra environment variables. */
+#define EXTRA_LD_LEN14_ENVVARS \
+ if (memcmp (envline, "LIBRARY64_PATH", 14) == 0) \
+ library_path = &envline[15]; \
+
+#define EXTRA_LD_AFTER_PROCESS_ENVVARS \
+ if (library64_path) \
+ library_path = library64_path;
+
+#define EXTRA_UNSECURE_ENVVARS "LD_LIBRARYN32_PATH\0LD_LIBRARY64_PATH\0"
+
+#endif
Index: elf/rtld.c
===================================================================
RCS file: /cvs/glibc/libc/elf/rtld.c,v
retrieving revision 1.279
diff -u -p -r1.279 rtld.c
--- elf/rtld.c 14 Mar 2003 05:34:36 -0000 1.279
+++ elf/rtld.c 14 Mar 2003 06:10:13 -0000
@@ -1759,6 +1759,11 @@ process_envvars (enum mode *modep)
char *envline;
enum mode mode = normal;
char *debug_output = NULL;
+ /* This macro may be used to declare variables used in other
+ EXTRA_LD macros. */
+#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)
@@ -1867,6 +1872,14 @@ process_envvars (enum mode *modep)
&& memcmp (envline, "PROFILE_OUTPUT", 14) == 0
&& envline[15] != '\0')
GL(dl_profile_output) = &envline[15];
+ /* Define this macro to handle other machine-specific
+ environment variables of post-LD_ length 14. */
+#ifdef EXTRA_LD_LEN14_ENVVARS
+ else
+ {
+ EXTRA_LD_LEN14_ENVVARS
+ }
+#endif
break;
case 16:
@@ -1895,6 +1908,16 @@ process_envvars (enum mode *modep)
#endif
}
}
+
+ /* Define this macro to do machine-specific post-processing of
+ environment variables, such as overriding library_path with
+ values collected from other machine-specific environment
+ variables. */
+#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