mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
* time/strftime.c (my_strftime): Delay use of *tp values until latest possible point to allow partly initialized structures (e.g., from strptime). * sysdeps/unix/sysv/linux/init-first.c [!PIC]: Define __libc_init_first using init-first.h. 1998-04-30 18:20 H.J. Lu <hjl@gnu.org> * elf/dl-load.c (_dl_init_paths): Don't check the dynamic loader if PIC is not defined. 1998-09-11 Ulrich Drepper <drepper@cygnus.com>
This commit is contained in:
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
1998-09-11 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* time/strftime.c (my_strftime): Delay use of *tp values until
|
||||||
|
latest possible point to allow partly initialized structures
|
||||||
|
(e.g., from strptime).
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/init-first.c [!PIC]: Define __libc_init_first
|
||||||
|
using init-first.h.
|
||||||
|
|
||||||
|
1998-04-30 18:20 H.J. Lu <hjl@gnu.org>
|
||||||
|
|
||||||
|
* elf/dl-load.c (_dl_init_paths): Don't check the dynamic
|
||||||
|
loader if PIC is not defined.
|
||||||
|
|
||||||
1998-09-11 Ulrich Drepper <drepper@cygnus.com>
|
1998-09-11 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* iconvdata/Makefile (modules): Add CSN_369103, CWI, DEC-MCS,
|
* iconvdata/Makefile (modules): Add CSN_369103, CWI, DEC-MCS,
|
||||||
|
133
elf/dl-load.c
133
elf/dl-load.c
@ -458,11 +458,13 @@ _dl_init_paths (const char *llp)
|
|||||||
struct r_search_path_elem *pelem, **aelem;
|
struct r_search_path_elem *pelem, **aelem;
|
||||||
size_t round_size;
|
size_t round_size;
|
||||||
|
|
||||||
|
#ifdef PIC
|
||||||
/* We have in `search_path' the information about the RPATH of the
|
/* We have in `search_path' the information about the RPATH of the
|
||||||
dynamic loader. Now fill in the information about the applications
|
dynamic loader. Now fill in the information about the applications
|
||||||
RPATH and the directories addressed by the LD_LIBRARY_PATH environment
|
RPATH and the directories addressed by the LD_LIBRARY_PATH environment
|
||||||
variable. */
|
variable. */
|
||||||
struct link_map *l;
|
struct link_map *l;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Number of elements in the library path. */
|
/* Number of elements in the library path. */
|
||||||
size_t nllp;
|
size_t nllp;
|
||||||
@ -526,84 +528,83 @@ _dl_init_paths (const char *llp)
|
|||||||
}
|
}
|
||||||
*aelem = NULL;
|
*aelem = NULL;
|
||||||
|
|
||||||
|
#ifdef PIC
|
||||||
|
/* This points to the map of the main object. */
|
||||||
l = _dl_loaded;
|
l = _dl_loaded;
|
||||||
if (l != NULL)
|
|
||||||
|
/* We should never get here when initializing in a static application.
|
||||||
|
If this is a dynamically linked application _dl_loaded always
|
||||||
|
points to the main map which is not dlopen()ed. */
|
||||||
|
assert (l->l_type != lt_loaded);
|
||||||
|
|
||||||
|
if (l->l_info[DT_RPATH])
|
||||||
{
|
{
|
||||||
/* We should never get here when initializing in a static application.
|
/* Allocate room for the search path and fill in information
|
||||||
If this is a dynamically linked application _dl_loaded always
|
from RPATH. */
|
||||||
points to the main map which is not dlopen()ed. */
|
l->l_rpath_dirs =
|
||||||
assert (l->l_type != lt_loaded);
|
decompose_rpath ((const char *)
|
||||||
|
(l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr
|
||||||
if (l->l_info[DT_RPATH])
|
+ l->l_info[DT_RPATH]->d_un.d_val),
|
||||||
{
|
nllp, l);
|
||||||
/* Allocate room for the search path and fill in information
|
|
||||||
from RPATH. */
|
|
||||||
l->l_rpath_dirs =
|
|
||||||
decompose_rpath ((const char *)
|
|
||||||
(l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr
|
|
||||||
+ l->l_info[DT_RPATH]->d_un.d_val),
|
|
||||||
nllp, l);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* If we have no LD_LIBRARY_PATH and no RPATH we must tell
|
|
||||||
this somehow to prevent we look this up again and again. */
|
|
||||||
if (nllp == 0)
|
|
||||||
l->l_rpath_dirs = (struct r_search_path_elem **) -1l;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
l->l_rpath_dirs = (struct r_search_path_elem **)
|
|
||||||
malloc ((nllp + 1) * sizeof (*l->l_rpath_dirs));
|
|
||||||
if (l->l_rpath_dirs == NULL)
|
|
||||||
_dl_signal_error (ENOMEM, NULL,
|
|
||||||
"cannot create cache for search path");
|
|
||||||
l->l_rpath_dirs[0] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We don't need to search the list of fake entries which is searched
|
|
||||||
when no dynamic objects were loaded at this time. */
|
|
||||||
fake_path_list = NULL;
|
|
||||||
|
|
||||||
if (nllp > 0)
|
|
||||||
{
|
|
||||||
char *copy = local_strdup (llp);
|
|
||||||
|
|
||||||
/* Decompose the LD_LIBRARY_PATH and fill in the result.
|
|
||||||
First search for the next place to enter elements. */
|
|
||||||
struct r_search_path_elem **result = l->l_rpath_dirs;
|
|
||||||
while (*result != NULL)
|
|
||||||
++result;
|
|
||||||
|
|
||||||
/* We need to take care that the LD_LIBRARY_PATH environment
|
|
||||||
variable can contain a semicolon. */
|
|
||||||
(void) fillin_rpath (copy, result, ":;",
|
|
||||||
__libc_enable_secure ? system_dirs : NULL,
|
|
||||||
"LD_LIBRARY_PATH", NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* This is a statically linked program but we still have to
|
/* If we have no LD_LIBRARY_PATH and no RPATH we must tell
|
||||||
take care for the LD_LIBRARY_PATH environment variable. We
|
this somehow to prevent we look this up again and again. */
|
||||||
use a fake link_map entry. This will only contain the
|
|
||||||
l_rpath_dirs information. */
|
|
||||||
|
|
||||||
if (nllp == 0)
|
if (nllp == 0)
|
||||||
fake_path_list = NULL;
|
l->l_rpath_dirs = (struct r_search_path_elem **) -1l;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fake_path_list = (struct r_search_path_elem **)
|
l->l_rpath_dirs = (struct r_search_path_elem **)
|
||||||
malloc ((nllp + 1) * sizeof (struct r_search_path_elem *));
|
malloc ((nllp + 1) * sizeof (*l->l_rpath_dirs));
|
||||||
if (fake_path_list == NULL)
|
if (l->l_rpath_dirs == NULL)
|
||||||
_dl_signal_error (ENOMEM, NULL,
|
_dl_signal_error (ENOMEM, NULL,
|
||||||
"cannot create cache for search path");
|
"cannot create cache for search path");
|
||||||
|
l->l_rpath_dirs[0] = NULL;
|
||||||
(void) fillin_rpath (local_strdup (llp), fake_path_list, ":;",
|
|
||||||
__libc_enable_secure ? system_dirs : NULL,
|
|
||||||
"LD_LIBRARY_PATH", NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We don't need to search the list of fake entries which is searched
|
||||||
|
when no dynamic objects were loaded at this time. */
|
||||||
|
fake_path_list = NULL;
|
||||||
|
|
||||||
|
if (nllp > 0)
|
||||||
|
{
|
||||||
|
char *copy = local_strdup (llp);
|
||||||
|
|
||||||
|
/* Decompose the LD_LIBRARY_PATH and fill in the result.
|
||||||
|
First search for the next place to enter elements. */
|
||||||
|
struct r_search_path_elem **result = l->l_rpath_dirs;
|
||||||
|
while (*result != NULL)
|
||||||
|
++result;
|
||||||
|
|
||||||
|
/* We need to take care that the LD_LIBRARY_PATH environment
|
||||||
|
variable can contain a semicolon. */
|
||||||
|
(void) fillin_rpath (copy, result, ":;",
|
||||||
|
__libc_enable_secure ? system_dirs : NULL,
|
||||||
|
"LD_LIBRARY_PATH", NULL);
|
||||||
|
}
|
||||||
|
#else /* !PIC */
|
||||||
|
/* This is a statically linked program but we still have to take
|
||||||
|
care for the LD_LIBRARY_PATH environment variable. We use a fake
|
||||||
|
link_map entry. This will only contain the l_rpath_dirs
|
||||||
|
information. */
|
||||||
|
|
||||||
|
if (nllp == 0)
|
||||||
|
fake_path_list = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fake_path_list = (struct r_search_path_elem **)
|
||||||
|
malloc ((nllp + 1) * sizeof (struct r_search_path_elem *));
|
||||||
|
if (fake_path_list == NULL)
|
||||||
|
_dl_signal_error (ENOMEM, NULL,
|
||||||
|
"cannot create cache for search path");
|
||||||
|
|
||||||
|
(void) fillin_rpath (local_strdup (llp), fake_path_list, ":;",
|
||||||
|
__libc_enable_secure ? system_dirs : NULL,
|
||||||
|
"LD_LIBRARY_PATH", NULL);
|
||||||
|
}
|
||||||
|
#endif /* PIC */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,11 +93,7 @@ __libc_init_first (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
void
|
SYSDEP_CALL_INIT(__libc_init_first, init);
|
||||||
__libc_init_first (int argc, char **argv, char **envp)
|
|
||||||
{
|
|
||||||
init (argc, argv, envp);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -416,15 +416,25 @@ my_strftime (s, maxsize, format, tp)
|
|||||||
{
|
{
|
||||||
int hour12 = tp->tm_hour;
|
int hour12 = tp->tm_hour;
|
||||||
#ifdef _NL_CURRENT
|
#ifdef _NL_CURRENT
|
||||||
const char *const a_wkday = _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday);
|
/* We cannot make the following values variables since we must dealy
|
||||||
const char *const f_wkday = _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday);
|
the evaluation of these values until really needed since some
|
||||||
const char *const a_month = _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon);
|
expressions might not be valid in every situation. The `struct tm'
|
||||||
const char *const f_month = _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon);
|
might be generated by a strptime() call and therefore initialized
|
||||||
const char *const ampm = _NL_CURRENT (LC_TIME,
|
only a few elements. Dereference the pointers only if the format
|
||||||
hour12 > 11 ? PM_STR : AM_STR);
|
requires this. Then it is ok to fail if the pointers are invalid. */
|
||||||
size_t aw_len = strlen (a_wkday);
|
# define a_wkday _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday)
|
||||||
size_t am_len = strlen (a_month);
|
# define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday)
|
||||||
size_t ap_len = strlen (ampm);
|
# define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday)
|
||||||
|
# define a_month _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon)
|
||||||
|
# define f_month _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon)
|
||||||
|
# define ampm _NL_CURRENT (LC_TIME, hour12 > 11 ? PM_STR : AM_STR)
|
||||||
|
|
||||||
|
# define aw_len strlen (a_wkday)
|
||||||
|
# define am_len strlen (a_month)
|
||||||
|
# define ap_len strlen (ampm)
|
||||||
|
|
||||||
|
# define wkday_len strlen (f_wkday)
|
||||||
|
# define month_len strlen (f_month)
|
||||||
#else
|
#else
|
||||||
# if !HAVE_STRFTIME
|
# if !HAVE_STRFTIME
|
||||||
const char *const f_wkday = weekday_name[tp->tm_wday];
|
const char *const f_wkday = weekday_name[tp->tm_wday];
|
||||||
@ -435,14 +445,12 @@ my_strftime (s, maxsize, format, tp)
|
|||||||
size_t aw_len = 3;
|
size_t aw_len = 3;
|
||||||
size_t am_len = 3;
|
size_t am_len = 3;
|
||||||
size_t ap_len = 2;
|
size_t ap_len = 2;
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#if defined _NL_CURRENT || !HAVE_STRFTIME
|
|
||||||
size_t wkday_len = strlen (f_wkday);
|
size_t wkday_len = strlen (f_wkday);
|
||||||
size_t month_len = strlen (f_month);
|
size_t month_len = strlen (f_month);
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
const char *zone;
|
const char *zone;
|
||||||
size_t zonelen;
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
char *p = s;
|
char *p = s;
|
||||||
const char *f;
|
const char *f;
|
||||||
@ -457,21 +465,12 @@ my_strftime (s, maxsize, format, tp)
|
|||||||
POSIX does not require it. Do the right thing instead. */
|
POSIX does not require it. Do the right thing instead. */
|
||||||
zone = (const char *) tp->tm_zone;
|
zone = (const char *) tp->tm_zone;
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_TZNAME
|
#if HAVE_TZNAME && HAVE_TZSET
|
||||||
/* POSIX.1 8.1.1 requires that whenever strftime() is called, the
|
/* POSIX.1 8.1.1 requires that whenever strftime() is called, the
|
||||||
time zone names contained in the external variable `tzname' shall
|
time zone names contained in the external variable `tzname' shall
|
||||||
be set as if the tzset() function had been called. */
|
be set as if the tzset() function had been called. */
|
||||||
# if HAVE_TZSET
|
|
||||||
tzset ();
|
tzset ();
|
||||||
# endif
|
|
||||||
|
|
||||||
if (!(zone && *zone) && tp->tm_isdst >= 0)
|
|
||||||
zone = tzname[tp->tm_isdst];
|
|
||||||
#endif
|
#endif
|
||||||
if (! zone)
|
|
||||||
zone = ""; /* POSIX.2 requires the empty string here. */
|
|
||||||
|
|
||||||
zonelen = strlen (zone);
|
|
||||||
|
|
||||||
if (hour12 > 12)
|
if (hour12 > 12)
|
||||||
hour12 -= 12;
|
hour12 -= 12;
|
||||||
@ -1146,7 +1145,16 @@ my_strftime (s, maxsize, format, tp)
|
|||||||
to_uppcase = 0;
|
to_uppcase = 0;
|
||||||
to_lowcase = 1;
|
to_lowcase = 1;
|
||||||
}
|
}
|
||||||
cpy (zonelen, zone);
|
|
||||||
|
#if HAVE_TZNAME
|
||||||
|
/* The tzset() call might have changed the value. */
|
||||||
|
if (!(zone && *zone) && tp->tm_isdst >= 0)
|
||||||
|
zone = tzname[tp->tm_isdst];
|
||||||
|
#endif
|
||||||
|
if (! zone)
|
||||||
|
zone = ""; /* POSIX.2 requires the empty string here. */
|
||||||
|
|
||||||
|
cpy (strlen (zone), zone);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'z': /* GNU extension. */
|
case 'z': /* GNU extension. */
|
||||||
|
Reference in New Issue
Block a user