[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r8649 - in /fsf/trunk/libc: ChangeLog elf/dl-misc.c elf/elf.h include/inline-hashtab.h
- To: commits@xxxxxxxxxx
- Subject: [commits] r8649 - in /fsf/trunk/libc: ChangeLog elf/dl-misc.c elf/elf.h include/inline-hashtab.h
- From: eglibc@xxxxxxxxxx
- Date: Wed, 08 Jul 2009 07:11:02 -0000
Author: eglibc
Date: Wed Jul 8 00:11:02 2009
New Revision: 8649
Log:
Import glibc-mainline for 2009-07-08
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/elf/dl-misc.c
fsf/trunk/libc/elf/elf.h
fsf/trunk/libc/include/inline-hashtab.h
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Jul 8 00:11:02 2009
@@ -1,3 +1,12 @@
+2009-07-07 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * elf/elf.h (STB_GNU_UNIQUE): Define.
+
+ * elf/dl-misc.c (_dl_higher_prime_number): New function. Moved here
+ from...
+ * include/inline-hashtab.h: ...here.
+ (htab_expand): Adjust for renamed function. Correct memory handling.
+
2009-07-06 Ulrich Drepper <drepper@xxxxxxxxxx>
* elf/do-lookup.h (ALLOWED_STT): Optimize test for valid symbol types.
Modified: fsf/trunk/libc/elf/dl-misc.c
==============================================================================
--- fsf/trunk/libc/elf/dl-misc.c (original)
+++ fsf/trunk/libc/elf/dl-misc.c Wed Jul 8 00:11:02 2009
@@ -312,3 +312,67 @@
return 0;
}
+
+
+unsigned long int
+_dl_higher_prime_number (unsigned long int n)
+{
+ /* These are primes that are near, but slightly smaller than, a
+ power of two. */
+ static const uint32_t primes[] = {
+ UINT32_C (7),
+ UINT32_C (13),
+ UINT32_C (31),
+ UINT32_C (61),
+ UINT32_C (127),
+ UINT32_C (251),
+ UINT32_C (509),
+ UINT32_C (1021),
+ UINT32_C (2039),
+ UINT32_C (4093),
+ UINT32_C (8191),
+ UINT32_C (16381),
+ UINT32_C (32749),
+ UINT32_C (65521),
+ UINT32_C (131071),
+ UINT32_C (262139),
+ UINT32_C (524287),
+ UINT32_C (1048573),
+ UINT32_C (2097143),
+ UINT32_C (4194301),
+ UINT32_C (8388593),
+ UINT32_C (16777213),
+ UINT32_C (33554393),
+ UINT32_C (67108859),
+ UINT32_C (134217689),
+ UINT32_C (268435399),
+ UINT32_C (536870909),
+ UINT32_C (1073741789),
+ UINT32_C (2147483647),
+ /* 4294967291L */
+ UINT32_C (2147483647) + UINT32_C (2147483644)
+ };
+
+ const uint32_t *low = &primes[0];
+ const uint32_t *high = &primes[sizeof (primes) / sizeof (primes[0])];
+
+ while (low != high)
+ {
+ const uint32_t *mid = low + (high - low) / 2;
+ if (n > *mid)
+ low = mid + 1;
+ else
+ high = mid;
+ }
+
+#if 0
+ /* If we've run out of primes, abort. */
+ if (n > *low)
+ {
+ fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
+ abort ();
+ }
+#endif
+
+ return *low;
+}
Modified: fsf/trunk/libc/elf/elf.h
==============================================================================
--- fsf/trunk/libc/elf/elf.h (original)
+++ fsf/trunk/libc/elf/elf.h Wed Jul 8 00:11:02 2009
@@ -444,6 +444,7 @@
#define STB_WEAK 2 /* Weak symbol */
#define STB_NUM 3 /* Number of defined types. */
#define STB_LOOS 10 /* Start of OS-specific */
+#define STB_GNU_UNIQUE 10 /* Unique symbol. */
#define STB_HIOS 12 /* End of OS-specific */
#define STB_LOPROC 13 /* Start of processor-specific */
#define STB_HIPROC 15 /* End of processor-specific */
Modified: fsf/trunk/libc/include/inline-hashtab.h
==============================================================================
--- fsf/trunk/libc/include/inline-hashtab.h (original)
+++ fsf/trunk/libc/include/inline-hashtab.h Wed Jul 8 00:11:02 2009
@@ -1,7 +1,5 @@
/* Fully-inline hash table, used mainly for managing TLS descriptors.
-
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2008
- Free Software Foundation, Inc.
+ Copyright (C) 1999-2003, 2005, 2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Alexandre Oliva <aoliva@xxxxxxxxxx>
@@ -29,69 +27,6 @@
# define INLINE_HASHTAB_H 1
extern void weak_function free (void *ptr);
-
-inline static unsigned long
-higher_prime_number (unsigned long n)
-{
- /* These are primes that are near, but slightly smaller than, a
- power of two. */
- static const uint32_t primes[] = {
- UINT32_C (7),
- UINT32_C (13),
- UINT32_C (31),
- UINT32_C (61),
- UINT32_C (127),
- UINT32_C (251),
- UINT32_C (509),
- UINT32_C (1021),
- UINT32_C (2039),
- UINT32_C (4093),
- UINT32_C (8191),
- UINT32_C (16381),
- UINT32_C (32749),
- UINT32_C (65521),
- UINT32_C (131071),
- UINT32_C (262139),
- UINT32_C (524287),
- UINT32_C (1048573),
- UINT32_C (2097143),
- UINT32_C (4194301),
- UINT32_C (8388593),
- UINT32_C (16777213),
- UINT32_C (33554393),
- UINT32_C (67108859),
- UINT32_C (134217689),
- UINT32_C (268435399),
- UINT32_C (536870909),
- UINT32_C (1073741789),
- UINT32_C (2147483647),
- /* 4294967291L */
- UINT32_C (2147483647) + UINT32_C (2147483644)
- };
-
- const uint32_t *low = &primes[0];
- const uint32_t *high = &primes[sizeof (primes) / sizeof (primes[0])];
-
- while (low != high)
- {
- const uint32_t *mid = low + (high - low) / 2;
- if (n > *mid)
- low = mid + 1;
- else
- high = mid;
- }
-
-#if 0
- /* If we've run out of primes, abort. */
- if (n > *low)
- {
- fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
- abort ();
- }
-#endif
-
- return *low;
-}
struct hashtab
{
@@ -203,12 +138,11 @@
/* Resize only when table after removal of unused elements is either
too full or too empty. */
if (htab->n_elements * 2 > htab->size)
- nsize = higher_prime_number (htab->n_elements * 2);
+ nsize = _dl_higher_prime_number (htab->n_elements * 2);
else
nsize = htab->size;
- nentries = malloc (sizeof (void *) * nsize);
- memset (nentries, 0, sizeof (void *) * nsize);
+ nentries = calloc (sizeof (void *), nsize);
if (nentries == NULL)
return 0;
htab->entries = nentries;