2000-10-24  Paul Eggert  <eggert@twinsun.com>

	* time/strftime.c (my_strftime macro)
	[!defined _LIBC && HAVE_TZNAME && HAVE_TZSET]:
	When redefining, do it without args, so that it works even if
	emacs is defined and an extra argument is passed to my_stftime.
	(my_strftime function): When evaluating a subformat, pass
	ut_argument as well.

2000-10-24  Andreas Schwab  <schwab@suse.de>

	* sysdeps/unix/sysv/linux/ia64/Versions: Add pciconfig_read and
	pciconfig_write.

	* sysdeps/generic/dl-cache.c (_dl_cache_verify_ptr): Correct test
	for files with new cache format.
	(_dl_load_cache_lookup): Add variable cache_data_size for size of the
	data.  Correctly report error if neither old not new signature is
	found. Little optimizations.
	Mostly based on a patch by Denis Zaitsev <zzz@cd-club.ru>.
This commit is contained in:
Ulrich Drepper 2000-10-25 08:23:00 +00:00
parent 7e036a0134
commit b05598ef31
4 changed files with 48 additions and 20 deletions

View File

@ -1,5 +1,26 @@
2000-10-24 Paul Eggert <eggert@twinsun.com>
* time/strftime.c (my_strftime macro)
[!defined _LIBC && HAVE_TZNAME && HAVE_TZSET]:
When redefining, do it without args, so that it works even if
emacs is defined and an extra argument is passed to my_stftime.
(my_strftime function): When evaluating a subformat, pass
ut_argument as well.
2000-10-24 Andreas Schwab <schwab@suse.de>
* sysdeps/unix/sysv/linux/ia64/Versions: Add pciconfig_read and
pciconfig_write.
2000-10-25 Ulrich Drepper <drepper@redhat.com> 2000-10-25 Ulrich Drepper <drepper@redhat.com>
* sysdeps/generic/dl-cache.c (_dl_cache_verify_ptr): Correct test
for files with new cache format.
(_dl_load_cache_lookup): Add variable cache_data_size for size of the
data. Correctly report error if neither old not new signature is
found. Little optimizations.
Mostly based on a patch by Denis Zaitsev <zzz@cd-club.ru>.
* elf/dl-close.c (_dl_close): Optimize a bit by optimizing out the * elf/dl-close.c (_dl_close): Optimize a bit by optimizing out the
nsearchlist variable. nsearchlist variable.

View File

@ -17,6 +17,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <ldsodefs.h> #include <ldsodefs.h>
#include <sys/mman.h> #include <sys/mman.h>
@ -35,7 +36,7 @@ static struct cache_file_new *cache_new;
static size_t cachesize; static size_t cachesize;
/* 1 if cache_data + PTR points into the cache. */ /* 1 if cache_data + PTR points into the cache. */
#define _dl_cache_verify_ptr(ptr) (ptr < cachesize - sizeof *cache) #define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size)
/* This is the cache ID we expect. Normally it is 3 for glibc linked /* This is the cache ID we expect. Normally it is 3 for glibc linked
binaries. */ binaries. */
@ -146,6 +147,7 @@ _dl_load_cache_lookup (const char *name)
int left, right, middle; int left, right, middle;
int cmpres; int cmpres;
const char *cache_data; const char *cache_data;
uint32_t cache_data_size;
const char *best; const char *best;
/* Print a message if the loading of libs is traced. */ /* Print a message if the loading of libs is traced. */
@ -163,8 +165,8 @@ _dl_load_cache_lookup (const char *name)
- the old format with the new format in it - the old format with the new format in it
- only the new format - only the new format
The following checks if the cache contains any of these formats. */ The following checks if the cache contains any of these formats. */
if (file && cachesize > sizeof *cache && if (file != NULL && cachesize > sizeof *cache
!memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1)) && memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1) == 0)
{ {
size_t offset; size_t offset;
/* Looks ok. */ /* Looks ok. */
@ -174,31 +176,27 @@ _dl_load_cache_lookup (const char *name)
offset = ALIGN_CACHE (sizeof (struct cache_file) offset = ALIGN_CACHE (sizeof (struct cache_file)
+ cache->nlibs * sizeof (struct file_entry)); + cache->nlibs * sizeof (struct file_entry));
cache_new = (struct cache_file_new *) ((void *)cache + offset); cache_new = (struct cache_file_new *) ((void *) cache + offset);
if (cachesize < (offset + sizeof (struct cache_file_new)) if (cachesize < (offset + sizeof (struct cache_file_new))
|| memcmp (cache_new->magic, CACHEMAGIC_NEW, || memcmp (cache_new->magic, CACHEMAGIC_VERSION_NEW,
sizeof CACHEMAGIC_NEW - 1) sizeof CACHEMAGIC_VERSION_NEW - 1) != 0)
|| memcmp (cache_new->version, CACHE_VERSION,
sizeof CACHE_VERSION - 1))
cache_new = (void *) -1; cache_new = (void *) -1;
} }
else if (file && cachesize > sizeof *cache_new) else if (file != NULL && cachesize > sizeof *cache_new
&& memcmp (cache_new->magic, CACHEMAGIC_VERSION_NEW,
sizeof CACHEMAGIC_VERSION_NEW - 1) == 0)
{ {
cache_new = file; cache_new = file;
cache = file; cache = file;
if (memcmp (cache_new->magic, CACHEMAGIC_NEW,
sizeof CACHEMAGIC_NEW - 1)
|| memcmp (cache_new->version, CACHE_VERSION,
sizeof CACHE_VERSION - 1))
cache_new = (void *) -1;
} }
else else
{ {
if (file) if (file != NULL)
__munmap (file, cachesize); __munmap (file, cachesize);
cache = (void *) -1; cache = (void *) -1;
return NULL;
} }
assert (cache != NULL);
} }
if (cache == (void *) -1) if (cache == (void *) -1)
@ -216,6 +214,9 @@ _dl_load_cache_lookup (const char *name)
/* This is where the strings start. */ /* This is where the strings start. */
cache_data = (const char *) cache_new; cache_data = (const char *) cache_new;
/* Now we can compute how large the string table is. */
cache_data_size = (const char *) cache + cachesize - cache_data;
hwcap = &_dl_hwcap; hwcap = &_dl_hwcap;
#define HWCAP_CHECK \ #define HWCAP_CHECK \
@ -227,6 +228,10 @@ _dl_load_cache_lookup (const char *name)
{ {
/* This is where the strings start. */ /* This is where the strings start. */
cache_data = (const char *) &cache->libs[cache->nlibs]; cache_data = (const char *) &cache->libs[cache->nlibs];
/* Now we can compute how large the string table is. */
cache_data_size = (const char *) cache + cachesize - cache_data;
#undef HWCAP_CHECK #undef HWCAP_CHECK
#define HWCAP_CHECK do {} while (0) #define HWCAP_CHECK do {} while (0)
SEARCH_CACHE (cache); SEARCH_CACHE (cache);

View File

@ -11,6 +11,7 @@ libc {
_inb; _inw; _inl; _inb; _inw; _inl;
outb; outw; _outl; outb; outw; _outl;
_outb; _outw; _outl; _outb; _outw; _outl;
pciconfig_read; pciconfig_write;
# linuxthreads # linuxthreads
__clone2; __clone2;

View File

@ -455,8 +455,7 @@ static CHAR_T const month_name[][10] =
return _strftime_copytm (s, maxsize, format, &tmcopy ut_argument); return _strftime_copytm (s, maxsize, format, &tmcopy ut_argument);
} }
# undef my_strftime # undef my_strftime
# define my_strftime(S, Maxsize, Format, Tp) \ # define my_strftime _strftime_copytm
_strftime_copytm (S, Maxsize, Format, Tp)
#endif #endif
@ -799,8 +798,10 @@ my_strftime (s, maxsize, format, tp ut_argument)
subformat: subformat:
{ {
CHAR_T *old_start = p; CHAR_T *old_start = p;
size_t len = my_strftime (NULL, (size_t) -1, subfmt, tp); size_t len = my_strftime (NULL, (size_t) -1, subfmt,
add (len, my_strftime (p, maxsize - i, subfmt, tp)); tp ut_argument);
add (len, my_strftime (p, maxsize - i, subfmt,
tp ut_argument));
if (to_uppcase) if (to_uppcase)
while (old_start < p) while (old_start < p)