1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
2002-08-28  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/ia64/elf/configure.in (PI_STATIC_AND_HIDDEN): Define
	unconditionally.
	* sysdeps/alpha/elf/configure.in (libc_cv_alpha_hidden_gprel): New
	check.
	(PI_STATIC_AND_HIDDEN): Define if check succeeded.

2002-08-28  Jakub Jelinek  <jakub@redhat.com>

	* locale/loadarchive.c (_nl_load_locale_from_archive): Add fd >= 0
	check to close_and_out close.  Replace return NULL statements where
	fd might be >= 0 with goto close_and_out.  Close the file descriptor
	when it is no longer needed.
This commit is contained in:
Ulrich Drepper
2002-08-28 22:37:20 +00:00
parent 669ed63814
commit dd4f211573
9 changed files with 118 additions and 15 deletions

View File

@ -1,3 +1,18 @@
2002-08-28 Jakub Jelinek <jakub@redhat.com>
* sysdeps/ia64/elf/configure.in (PI_STATIC_AND_HIDDEN): Define
unconditionally.
* sysdeps/alpha/elf/configure.in (libc_cv_alpha_hidden_gprel): New
check.
(PI_STATIC_AND_HIDDEN): Define if check succeeded.
2002-08-28 Jakub Jelinek <jakub@redhat.com>
* locale/loadarchive.c (_nl_load_locale_from_archive): Add fd >= 0
check to close_and_out close. Replace return NULL statements where
fd might be >= 0 with goto close_and_out. Close the file descriptor
when it is no longer needed.
2002-08-28 Ulrich Drepper <drepper@redhat.com> 2002-08-28 Ulrich Drepper <drepper@redhat.com>
* sysdeps/s390/s390-64/dl-machine.h: Avoid unescaped newlines in * sysdeps/s390/s390-64/dl-machine.h: Avoid unescaped newlines in

6
NEWS
View File

@ -1,4 +1,4 @@
GNU C Library NEWS -- history of user-visible changes. 2002-8-21 GNU C Library NEWS -- history of user-visible changes. 2002-8-28
Copyright (C) 1992-2000,01,02 Free Software Foundation, Inc. Copyright (C) 1992-2000,01,02 Free Software Foundation, Inc.
See the end for copying conditions. See the end for copying conditions.
@ -47,6 +47,10 @@ Version 2.3
* Loading of locale data is faster due to the introduction of a locale * Loading of locale data is faster due to the introduction of a locale
archive. Implemented by Roland McGrath and Ulrich Drepper. archive. Implemented by Roland McGrath and Ulrich Drepper.
* Startup times are significantly reduced by not using exported functions
inside the library itself. Changes by Jakub Jelinek, Roland McGrath,
and Ulrich Drepper.
Version 2.2.5 Version 2.2.5

View File

@ -1,3 +1,9 @@
2002-08-28 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/timer_routines.c (thread_func): Change return
type to void and add casts in use to avoid warnings wit all gcc
versions.
2002-08-08 Jakub Jelinek <jakub@redhat.com> 2002-08-08 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/bits/local_lim.h (PTHREAD_THREADS_MAX): * sysdeps/unix/sysv/linux/bits/local_lim.h (PTHREAD_THREADS_MAX):

View File

@ -369,7 +369,7 @@ thread_expire_timer (struct thread_node *self, struct timer_node *timer)
function is to wait on the thread's timer queue and expire the function is to wait on the thread's timer queue and expire the
timers in chronological order as close to their scheduled time as timers in chronological order as close to their scheduled time as
possible. */ possible. */
static void * static void
__attribute__ ((noreturn)) __attribute__ ((noreturn))
thread_func (void *arg) thread_func (void *arg)
{ {
@ -449,9 +449,6 @@ thread_func (void *arg)
/* This macro will never be executed since the while loop loops /* This macro will never be executed since the while loop loops
forever - but we have to add it for proper nesting. */ forever - but we have to add it for proper nesting. */
pthread_cleanup_pop (1); pthread_cleanup_pop (1);
/* NOTREACHED */
return NULL;
} }
@ -492,7 +489,8 @@ __timer_thread_start (struct thread_node *thread)
assert (!thread->exists); assert (!thread->exists);
thread->exists = 1; thread->exists = 1;
if (pthread_create (&thread->id, &thread->attr, thread_func, thread) != 0) if (pthread_create (&thread->id, &thread->attr,
(void (*) (void *)) thread_func, thread) != 0)
{ {
thread->exists = 0; thread->exists = 0;
retval = -1; retval = -1;

View File

@ -211,7 +211,8 @@ _nl_load_locale_from_archive (int category, const char **namep)
{ {
/* stat failed, very strange. */ /* stat failed, very strange. */
close_and_out: close_and_out:
__close (fd); if (fd >= 0)
__close (fd);
return NULL; return NULL;
} }
@ -262,7 +263,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
/* If there is no archive or it cannot be loaded for some reason fail. */ /* If there is no archive or it cannot be loaded for some reason fail. */
if (__builtin_expect (headmap.ptr == NULL, 0)) if (__builtin_expect (headmap.ptr == NULL, 0))
return NULL; goto close_and_out;
/* We have the archive available. To find the name we first have to /* We have the archive available. To find the name we first have to
determine its hash value. */ determine its hash value. */
@ -281,7 +282,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
{ {
if (namehashtab[idx].name_offset == 0) if (namehashtab[idx].name_offset == 0)
/* Not found. */ /* Not found. */
return NULL; goto close_and_out;
if (namehashtab[idx].hashval == hval if (namehashtab[idx].hashval == hval
&& strcmp (name, headmap.ptr + namehashtab[idx].name_offset) == 0) && strcmp (name, headmap.ptr + namehashtab[idx].name_offset) == 0)
@ -295,7 +296,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
/* We found an entry. It might be a placeholder for a removed one. */ /* We found an entry. It might be a placeholder for a removed one. */
if (namehashtab[idx].locrec_offset == 0) if (namehashtab[idx].locrec_offset == 0)
return NULL; goto close_and_out;
locrec = (struct locrecent *) (headmap.ptr + namehashtab[idx].locrec_offset); locrec = (struct locrecent *) (headmap.ptr + namehashtab[idx].locrec_offset);
@ -309,7 +310,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
if (locrec->record[cnt].offset + locrec->record[cnt].len if (locrec->record[cnt].offset + locrec->record[cnt].len
> headmap.len) > headmap.len)
/* The archive locrectab contains bogus offsets. */ /* The archive locrectab contains bogus offsets. */
return NULL; goto close_and_out;
results[cnt].addr = headmap.ptr + locrec->record[cnt].offset; results[cnt].addr = headmap.ptr + locrec->record[cnt].offset;
results[cnt].len = locrec->record[cnt].len; results[cnt].len = locrec->record[cnt].len;
} }
@ -376,7 +377,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
to = ranges[upper].from + ranges[upper].len; to = ranges[upper].from + ranges[upper].len;
if (to > (size_t) archive_stat.st_size) if (to > (size_t) archive_stat.st_size)
/* The archive locrectab contains bogus offsets. */ /* The archive locrectab contains bogus offsets. */
return NULL; goto close_and_out;
to = (to + ps - 1) & ~(ps - 1); to = (to + ps - 1) & ~(ps - 1);
/* If a range is already mmaped in, stop. */ /* If a range is already mmaped in, stop. */
@ -404,21 +405,21 @@ _nl_load_locale_from_archive (int category, const char **namep)
|| st.st_mtime != archive_stat.st_mtime || st.st_mtime != archive_stat.st_mtime
|| st.st_dev != archive_stat.st_dev || st.st_dev != archive_stat.st_dev
|| st.st_ino != archive_stat.st_ino) || st.st_ino != archive_stat.st_ino)
return NULL; goto close_and_out;
} }
/* Map the range from the archive. */ /* Map the range from the archive. */
addr = __mmap64 (NULL, to - from, PROT_READ, MAP_FILE|MAP_COPY, addr = __mmap64 (NULL, to - from, PROT_READ, MAP_FILE|MAP_COPY,
fd, from); fd, from);
if (addr == MAP_FAILED) if (addr == MAP_FAILED)
return NULL; goto close_and_out;
/* Allocate a record for this mapping. */ /* Allocate a record for this mapping. */
newp = (struct archmapped *) malloc (sizeof (struct archmapped)); newp = (struct archmapped *) malloc (sizeof (struct archmapped));
if (newp == NULL) if (newp == NULL)
{ {
(void) __munmap (addr, to - from); (void) __munmap (addr, to - from);
return NULL; goto close_and_out;
} }
/* And queue it. */ /* And queue it. */
@ -443,6 +444,11 @@ _nl_load_locale_from_archive (int category, const char **namep)
} }
} }
/* We don't need the file descriptor any longer. */
if (fd >= 0)
__close (fd);
fd = -1;
/* We succeeded in mapping all the necessary regions of the archive. /* We succeeded in mapping all the necessary regions of the archive.
Now we need the expected data structures to point into the data. */ Now we need the expected data structures to point into the data. */

View File

@ -58,3 +58,38 @@ EOF
fi fi
fi fi
echo $ac_n "checking for GP relative module local relocs""... $ac_c" 1>&6
echo "configure:20: checking for GP relative module local relocs" >&5
if eval "test \"`echo '$''{'libc_cv_alpha_hidden_gprel'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<\EOF
static int bar;
int baz __attribute__((visibility("hidden")));
int foo (void)
{
return bar + baz;
}
EOF
libc_cv_alpha_hidden_gprel=no
if { ac_try='${CC-cc} -S $CFLAGS -O2 -fpic conftest.c 1>&5'; { (eval echo configure:35: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
if grep -q 'bar.*!gprel' conftest.s \
&& grep -q 'baz.*!gprel' conftest.s \
&& ! grep -q 'bar.*!literal' conftest.s \
&& ! grep -q 'baz.*!literal' conftest.s; then
libc_cv_alpha_hidden_gprel=yes
fi
fi
rm -f conftest*
fi
echo "$ac_t""$libc_cv_alpha_hidden_gprel" 1>&6
if test $libc_cv_alpha_hidden_gprel = yes; then
cat >> confdefs.h <<\EOF
#define PI_STATIC_AND_HIDDEN 1
EOF
fi

View File

@ -51,3 +51,29 @@ if test $libc_cv_alpha_tls = yes; then
AC_DEFINE(HAVE_TLS_SUPPORT) AC_DEFINE(HAVE_TLS_SUPPORT)
fi fi
fi fi
AC_CACHE_CHECK(for GP relative module local relocs, libc_cv_alpha_hidden_gprel, [dnl
cat > conftest.c <<\EOF
static int bar;
int baz __attribute__((visibility("hidden")));
int foo (void)
{
return bar + baz;
}
EOF
dnl
libc_cv_alpha_hidden_gprel=no
if AC_TRY_COMMAND(${CC-cc} -S $CFLAGS -O2 -fpic conftest.c 1>&AC_FD_CC); then
if grep -q 'bar.*!gprel' conftest.s \
&& grep -q 'baz.*!gprel' conftest.s \
&& ! grep -q 'bar.*!literal' conftest.s \
&& ! grep -q 'baz.*!literal' conftest.s; then
libc_cv_alpha_hidden_gprel=yes
fi
fi
rm -f conftest*])
if test $libc_cv_alpha_hidden_gprel = yes; then
AC_DEFINE(PI_STATIC_AND_HIDDEN)
fi

6
sysdeps/ia64/elf/configure vendored Normal file
View File

@ -0,0 +1,6 @@
# Local configure fragment for sysdeps/ia64/elf.
cat >> confdefs.h <<\EOF
#define PI_STATIC_AND_HIDDEN 1
EOF

View File

@ -0,0 +1,7 @@
sinclude(./aclocal.m4)dnl Autoconf lossage
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Local configure fragment for sysdeps/ia64/elf.
dnl It is always possible to access static and hidden symbols in an
dnl position independent way.
AC_DEFINE(PI_STATIC_AND_HIDDEN)