This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi!
LD_ASSUME_KERNEL doesn't work for static binaries, the following patch makes
it work even for them (so you can influence what libraries it will use
during NSS lookups or ICONV).
2002-12-09 Jakub Jelinek <jakub@redhat.com>
* elf/dl-support.c (_dl_non_dynamic_init): Add DL_OSVERSION_INIT if
defined.
* sysdeps/unix/sysv/linux/dl-librecon.h (_dl_osversion_init): New
function.
(EXTRA_LD_ENVVARS): Use it.
(DL_OSVERSION_INIT): Define.
* sysdeps/unix/sysv/linux/i386/dl-librecon.h: Include linux
dl-librecon.h.
(EXTRA_LD_ENVVARS): Undef before defining. Use _dl_osversion_init.
--- libc/elf/dl-support.c.jj 2002-12-06 12:27:23.000000000 +0100
+++ libc/elf/dl-support.c 2002-12-09 16:57:58.000000000 +0100
@@ -214,6 +214,10 @@ _dl_non_dynamic_init (void)
DL_PLATFORM_INIT;
#endif
+#ifdef DL_OSVERSION_INIT
+ DL_OSVERSION_INIT;
+#endif
+
/* Now determine the length of the platform string. */
if (_dl_platform != NULL)
_dl_platformlen = strlen (_dl_platform);
--- libc/sysdeps/unix/sysv/linux/i386/dl-librecon.h.jj 2002-01-31 04:39:22.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/i386/dl-librecon.h 2002-12-09 17:15:06.000000000 +0100
@@ -19,7 +19,8 @@
02111-1307 USA. */
#ifndef _DL_LIBRECON_H
-#define _DL_LIBRECON_H 1
+
+#include <sysdeps/unix/sysv/linux/dl-librecon.h>
#define DISTINGUISH_LIB_VERSIONS \
do \
@@ -47,27 +48,12 @@
while (0)
/* Recognizing extra environment variables. */
+#undef EXTRA_LD_ENVVARS
#define EXTRA_LD_ENVVARS \
case 13: \
if (memcmp (envline, "ASSUME_KERNEL", 13) == 0) \
{ \
- unsigned long int i, j, osversion = 0; \
- char *p = &envline[14], *q; \
- \
- for (i = 0; i < 3; i++, p = q + 1) \
- { \
- j = __strtoul_internal (p, &q, 0, 0); \
- if (j >= 255 || p == q || (i < 2 && *q && *q != '.')) \
- { \
- osversion = 0; \
- break; \
- } \
- osversion |= j << (16 - 8 * i); \
- if (!*q) \
- break; \
- } \
- if (osversion) \
- GL(dl_osversion) = osversion; \
+ _dl_osversion_init (&envline[14]); \
break; \
} \
\
--- libc/sysdeps/unix/sysv/linux/dl-librecon.h.jj 2002-01-31 04:39:22.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/dl-librecon.h 2002-12-09 17:20:45.000000000 +0100
@@ -1,5 +1,5 @@
/* Optional code to distinguish library flavours.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
@@ -21,29 +21,42 @@
#ifndef _DL_LIBRECON_H
#define _DL_LIBRECON_H 1
+static inline void __attribute__ ((unused, always_inline))
+_dl_osversion_init (char *assume_kernel)
+{
+ unsigned long int i, j, osversion = 0;
+ char *p = assume_kernel, *q;
+
+ for (i = 0; i < 3; i++, p = q + 1)
+ {
+ j = __strtoul_internal (p, &q, 0, 0);
+ if (j >= 255 || p == q || (i < 2 && *q && *q != '.'))
+ {
+ osversion = 0;
+ break;
+ }
+ osversion |= j << (16 - 8 * i);
+ if (!*q)
+ break;
+ }
+ if (osversion)
+ GL(dl_osversion) = osversion;
+}
+
/* Recognizing extra environment variables. */
#define EXTRA_LD_ENVVARS \
case 13: \
if (memcmp (envline, "ASSUME_KERNEL", 13) == 0) \
{ \
- unsigned long int i, j, osversion = 0; \
- char *p = &envline[14], *q; \
- \
- for (i = 0; i < 3; i++, p = q + 1) \
- { \
- j = __strtoul_internal (p, &q, 0, 0); \
- if (j >= 255 || p == q || (i < 2 && *q && *q != '.')) \
- { \
- osversion = 0; \
- break; \
- } \
- osversion |= j << (16 - 8 * i); \
- if (!*q) \
- break; \
- } \
- if (osversion) \
- GL(dl_osversion) = osversion; \
+ _dl_osversion_init (&envline[14]); \
break; \
}
+#define DL_OSVERSION_INIT \
+ do { \
+ char *assume_kernel = getenv ("LD_ASSUME_KERNEL"); \
+ if (assume_kernel) \
+ _dl_osversion_init (assume_kernel); \
+ } while (0)
+
#endif /* dl-librecon.h */
Jakub
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |