[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r13801 - in /trunk: libc/ libc/elf/ libc/manual/ libc/misc/ libc/nptl/ libc/sysdeps/posix/ ports/ ports/sysdeps/mips/
- To: commits@xxxxxxxxxx
- Subject: [commits] r13801 - in /trunk: libc/ libc/elf/ libc/manual/ libc/misc/ libc/nptl/ libc/sysdeps/posix/ ports/ ports/sysdeps/mips/
- From: joseph@xxxxxxxxxx
- Date: Fri, 13 May 2011 15:10:18 -0000
Author: joseph
Date: Fri May 13 08:10:17 2011
New Revision: 13801
Log:
Merge changes between r13758 and r13800 from /fsf/trunk.
Added:
trunk/libc/elf/tst-unique4.cc
- copied unchanged from r13800, fsf/trunk/libc/elf/tst-unique4.cc
trunk/libc/elf/tst-unique4.h
- copied unchanged from r13800, fsf/trunk/libc/elf/tst-unique4.h
trunk/libc/elf/tst-unique4lib.cc
- copied unchanged from r13800, fsf/trunk/libc/elf/tst-unique4lib.cc
Modified:
trunk/libc/ChangeLog
trunk/libc/NEWS
trunk/libc/elf/Makefile
trunk/libc/elf/dl-load.c
trunk/libc/elf/dl-lookup.c
trunk/libc/manual/stdio.texi
trunk/libc/misc/mntent_r.c
trunk/libc/nptl/ChangeLog
trunk/libc/nptl/allocatestack.c
trunk/libc/sysdeps/posix/spawni.c
trunk/ports/ChangeLog.mips
trunk/ports/sysdeps/mips/dl-lookup.c
Modified: trunk/libc/ChangeLog
==============================================================================
--- trunk/libc/ChangeLog (original)
+++ trunk/libc/ChangeLog Fri May 13 08:10:17 2011
@@ -1,10 +1,41 @@
+2011-05-12 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12511]
+ * elf/dl-lookup.c (enter): Don't test for copy relocation here and
+ don't set DF_1_NODELETE here.
+ (do_lookup_x): When entering new entry test for copy relocation
+ and if necessary set DF_1_NODELETE flag.
+ * elf/tst-unique4.cc: New file.
+ * elf/tst-unique4.h: New file.
+ * elf/tst-unique4lib.cc: New file.
+ * elf/Makefile: Add rules to build and run tst-unique4.
+ Patch by Piotr Bury <pbury@xxxxxxxxxxx>.
+
+2011-05-11 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12052]
+ * sysdeps/posix/spawni.c (__spawni): Fix sched_setscheduler call.
+
+ [BZ #12625]
+ * misc/mntent_r.c (addmntent): Flush the stream after the output
+
+ [BZ #12393]
+ * elf/dl-load.c (is_trusted_path): Remove unnecessary test.
+ (is_trusted_path_normalize): Skip initial colon. Append slash
+ to empty buffer. Duplicate is_trusted_path code but allow
+ constructed patch to be prefix.
+ (is_dst): Allow $ORIGIN followed by /.
+ (_dl_dst_substitute): Correct clearing of check_for_trusted.
+ Correct testing of result of is_trusted_path_normalize
+ (decompose_rpath): Fix warning.
+
2011-05-10 Ulrich Drepper <drepper@xxxxxxxxx>
[BZ #11257]
* grp/initgroups.c (internal_getgrouplist): When we found the service
list through the initgroups entry in nsswitch.conf do not always
continue on a successful lookup. Don't always use the
- __nss_group_data-ase value if it is set.
+ __nss_group_database value if it is set.
* nss/nsswitch.conf (initgroups): Change action for successful db
lookup to continue for compatibility.
Modified: trunk/libc/NEWS
==============================================================================
--- trunk/libc/NEWS (original)
+++ trunk/libc/NEWS Fri May 13 08:10:17 2011
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2011-5-10
+GNU C Library NEWS -- history of user-visible changes. 2011-5-11
Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -9,11 +9,11 @@
* The following bugs are resolved with this release:
- 11257, 11258, 11487, 11532, 11578, 11653, 11668, 11724, 11945, 11947,
- 12158, 12178, 12200, 12346, 12393, 12420, 12445, 12449, 12454, 12460,
- 12469, 12489, 12509, 12510, 12518, 12541, 12545, 12551, 12583, 12587,
- 12597, 12611, 12631, 12650, 12653, 12655, 12660, 12681, 12685, 12711,
- 12713, 12714, 12717, 12723, 12734, 12738
+ 386, 11257, 11258, 11487, 11532, 11578, 11653, 11668, 11724, 11945, 11947,
+ 12052, 12158, 12178, 12200, 12346, 12393, 12420, 12445, 12449, 12454,
+ 12460, 12469, 12489, 12509, 12510, 12511, 12518, 12527, 12541, 12545,
+ 12551, 12583, 12587, 12597, 12611, 12625, 12631, 12650, 12653, 12655,
+ 12660, 12681, 12685, 12711, 12713, 12714, 12717, 12723, 12734, 12738
* The RPC implementation in libc is obsoleted. Old programs keep working
but new programs cannot be linked with the routines in libc anymore.
Modified: trunk/libc/elf/Makefile
==============================================================================
--- trunk/libc/elf/Makefile (original)
+++ trunk/libc/elf/Makefile Fri May 13 08:10:17 2011
@@ -202,7 +202,7 @@
unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \
tst-audit1 tst-audit2 \
tst-stackguard1 tst-addr1 tst-thrlock \
- tst-unique1 tst-unique2 tst-unique3 \
+ tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
tst-initorder
# reldep9
test-srcs = tst-pathopt
@@ -260,6 +260,7 @@
tst-unique1mod1 tst-unique1mod2 \
tst-unique2mod1 tst-unique2mod2 \
tst-unique3lib tst-unique3lib2 \
+ tst-unique4lib \
tst-initordera1 tst-initorderb1 \
tst-initordera2 tst-initorderb2 \
tst-initordera3 tst-initordera4
@@ -1201,6 +1202,8 @@
$(objpfx)tst-unique3: $(libdl) $(objpfx)tst-unique3lib.so
$(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so
+$(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so
+
$(objpfx)tst-initorder.out: $(objpfx)tst-initorder
$(elf-objpfx)${rtld-installed-name} \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
Modified: trunk/libc/elf/dl-load.c
==============================================================================
--- trunk/libc/elf/dl-load.c (original)
+++ trunk/libc/elf/dl-load.c Fri May 13 08:10:17 2011
@@ -171,10 +171,6 @@
static bool
is_trusted_path (const char *path, size_t len)
{
- /* All trusted directories must be complete names. */
- if (path[0] != '/')
- return false;
-
const char *trun = system_dirs;
for (size_t idx = 0; idx < nsystem_dirs_len; ++idx)
@@ -193,9 +189,17 @@
static bool
is_trusted_path_normalize (const char *path, size_t len)
{
+ if (len == 0)
+ return false;
+
+ if (*path == ':')
+ {
+ ++path;
+ --len;
+ }
+
char *npath = (char *) alloca (len + 2);
char *wnp = npath;
-
while (*path != '\0')
{
if (path[0] == '/')
@@ -225,11 +229,23 @@
*wnp++ = *path++;
}
- if (wnp > npath && wnp[-1] != '/')
+
+ if (wnp == npath || wnp[-1] != '/')
*wnp++ = '/';
- *wnp = '\0';
-
- return is_trusted_path (npath, wnp - npath);
+
+ const char *trun = system_dirs;
+
+ for (size_t idx = 0; idx < nsystem_dirs_len; ++idx)
+ {
+ if (wnp - npath >= system_dirs_len[idx]
+ && memcmp (trun, npath, system_dirs_len[idx]) == 0)
+ /* Found it. */
+ return true;
+
+ trun += system_dirs_len[idx] + 1;
+ }
+
+ return false;
}
@@ -265,7 +281,8 @@
return 0;
if (__builtin_expect (secure, 0)
- && ((name[len] != '\0' && (!is_path || name[len] != ':'))
+ && ((name[len] != '\0' && name[len] != '/'
+ && (!is_path || name[len] != ':'))
|| (name != start + 1 && (!is_path || name[-2] != ':'))))
return 0;
@@ -371,13 +388,12 @@
normalized path must be rooted in one of the trusted
directories. */
if (__builtin_expect (check_for_trusted, false)
- && is_trusted_path_normalize (last_elem, wp - last_elem))
- {
- wp = last_elem;
- check_for_trusted = false;
- }
+ && !is_trusted_path_normalize (last_elem, wp - last_elem))
+ wp = last_elem;
else
last_elem = wp;
+
+ check_for_trusted = false;
}
}
}
@@ -386,7 +402,7 @@
/* In SUID/SGID programs, after $ORIGIN expansion the normalized
path must be rooted in one of the trusted directories. */
if (__builtin_expect (check_for_trusted, false)
- && is_trusted_path_normalize (last_elem, wp - last_elem))
+ && !is_trusted_path_normalize (last_elem, wp - last_elem))
wp = last_elem;
*wp = '\0';
@@ -628,7 +644,7 @@
if (*copy == 0)
{
free (copy);
- sps->dirs = (char *) -1;
+ sps->dirs = (struct r_search_path_elem **) -1;
return false;
}
Modified: trunk/libc/elf/dl-lookup.c
==============================================================================
--- trunk/libc/elf/dl-lookup.c (original)
+++ trunk/libc/elf/dl-lookup.c Fri May 13 08:10:17 2011
@@ -312,39 +312,21 @@
definition we have to use it. */
void enter (struct unique_sym *table, size_t size,
unsigned int hash, const char *name,
- const ElfW(Sym) *sym, struct link_map *map)
+ const ElfW(Sym) *sym, const struct link_map *map)
{
size_t idx = hash % size;
size_t hash2 = 1 + hash % (size - 2);
- while (1)
+ while (table[idx].name != NULL)
{
- if (table[idx].name == NULL)
- {
- table[idx].hashval = hash;
- table[idx].name = name;
- if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
- {
- table[idx].sym = ref;
- table[idx].map = undef_map;
- }
- else
- {
- table[idx].sym = sym;
- table[idx].map = map;
-
- if (map->l_type == lt_loaded)
- /* Make sure we don't unload this object by
- setting the appropriate flag. */
- map->l_flags_1 |= DF_1_NODELETE;
- }
-
- return;
- }
-
idx += hash2;
if (idx >= size)
idx -= size;
}
+
+ table[idx].hashval = hash;
+ table[idx].name = name;
+ table[idx].sym = sym;
+ table[idx].map = map;
}
struct unique_sym_table *tab
@@ -450,8 +432,19 @@
tab->free = free;
}
- enter (entries, size, new_hash, strtab + sym->st_name, sym,
- (struct link_map *) map);
+ if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
+ enter (entries, size, new_hash, strtab + sym->st_name, ref,
+ undef_map);
+ else
+ {
+ enter (entries, size, new_hash, strtab + sym->st_name, sym,
+ map);
+
+ if (map->l_type == lt_loaded)
+ /* Make sure we don't unload this object by
+ setting the appropriate flag. */
+ ((struct link_map *) map)->l_flags_1 |= DF_1_NODELETE;
+ }
++tab->n_elements;
__rtld_lock_unlock_recursive (tab->lock);
Modified: trunk/libc/manual/stdio.texi
==============================================================================
--- trunk/libc/manual/stdio.texi (original)
+++ trunk/libc/manual/stdio.texi Fri May 13 08:10:17 2011
@@ -14,7 +14,7 @@
@menu
* Streams:: About the data type representing a stream.
* Standard Streams:: Streams to the standard input and output
- devices are created for you.
+ devices are created for you.
* Opening Streams:: How to create a stream to talk to a file.
* Closing Streams:: Close a stream when you are finished with it.
* Streams and Threads:: Issues with streams in threaded programs.
@@ -26,17 +26,17 @@
* Block Input/Output:: Input and output operations on blocks of data.
* Formatted Output:: @code{printf} and related functions.
* Customizing Printf:: You can define new conversion specifiers for
- @code{printf} and friends.
+ @code{printf} and friends.
* Formatted Input:: @code{scanf} and related functions.
* EOF and Errors:: How you can tell if an I/O error happens.
* Error Recovery:: What you can do about errors.
* Binary Streams:: Some systems distinguish between text files
- and binary files.
+ and binary files.
* File Positioning:: About random-access streams.
* Portable Positioning:: Random access on peculiar ISO C systems.
* Stream Buffering:: How to control buffering of streams.
* Other Kinds of Streams:: Streams that do not necessarily correspond
- to an open file.
+ to an open file.
* Formatted Messages:: Print strictly formatted messages.
@end menu
@@ -186,13 +186,11 @@
@end table
As you can see, @samp{+} requests a stream that can do both input and
-output. The ISO standard says that when using such a stream, you must
-call @code{fflush} (@pxref{Stream Buffering}) or a file positioning
-function such as @code{fseek} (@pxref{File Positioning}) when switching
-from reading to writing or vice versa. Otherwise, internal buffers
-might not be emptied properly. The GNU C library does not have this
-limitation; you can do arbitrary reading and writing operations on a
-stream in whatever order.
+output. When using such a stream, you must call @code{fflush}
+(@pxref{Stream Buffering}) or a file positioning function such as
+@code{fseek} (@pxref{File Positioning}) when switching from reading
+to writing or vice versa. Otherwise, internal buffers might not be
+emptied properly.
Additional characters may appear after these to specify flags for the
call. Always put the mode (@samp{r}, @samp{w+}, etc.) first; that is
@@ -1109,17 +1107,17 @@
/* @r{Write a space to separate answer from question.} */
fputc (' ', stdout);
/* @r{Read the first character of the line.}
- @r{This should be the answer character, but might not be.} */
+ @r{This should be the answer character, but might not be.} */
c = tolower (fgetc (stdin));
answer = c;
/* @r{Discard rest of input line.} */
while (c != '\n' && c != EOF)
- c = fgetc (stdin);
+ c = fgetc (stdin);
/* @r{Obey the answer if it was valid.} */
if (answer == 'y')
- return 1;
+ return 1;
if (answer == 'n')
- return 0;
+ return 0;
/* @r{Answer was invalid: ask for valid answer.} */
fputs ("Please answer y or n:", stdout);
@}
@@ -1328,7 +1326,7 @@
@smallexample
f o o b a r
- ^
+ ^
@end smallexample
@noindent
@@ -1340,7 +1338,7 @@
@smallexample
f o o b a r
- |
+ |
o--
^
@end smallexample
@@ -1354,7 +1352,7 @@
@smallexample
f o o b a r
- |
+ |
9--
^
@end smallexample
@@ -1527,19 +1525,19 @@
@menu
* Formatted Output Basics:: Some examples to get you started.
* Output Conversion Syntax:: General syntax of conversion
- specifications.
+ specifications.
* Table of Output Conversions:: Summary of output conversions and
- what they do.
+ what they do.
* Integer Conversions:: Details about formatting of integers.
* Floating-Point Conversions:: Details about formatting of
- floating-point numbers.
+ floating-point numbers.
* Other Output Conversions:: Details about formatting of strings,
- characters, pointers, and the like.
+ characters, pointers, and the like.
* Formatted Output Functions:: Descriptions of the actual functions.
* Dynamic Output:: Functions that allocate memory for the output.
* Variable Arguments Output:: @code{vprintf} and friends.
* Parsing a Template String:: What kinds of args does a given template
- call for?
+ call for?
* Example of Parsing:: Sample program using @code{parse_printf_format}.
@end menu
@@ -1561,7 +1559,7 @@
int pct = 37;
char filename[] = "foo.txt";
printf ("Processing of `%s' is %d%% finished.\nPlease be patient.\n",
- filename, pct);
+ filename, pct);
@end smallexample
@noindent
@@ -2350,20 +2348,20 @@
/* @r{Try to print in the allocated space.} */
nchars = snprintf (buffer, size, "value of %s is %s",
- name, value);
+ name, value);
@end group
@group
if (nchars >= size)
@{
/* @r{Reallocate buffer now that we know
- how much space is needed.} */
+ how much space is needed.} */
size = nchars + 1;
buffer = (char *) xrealloc (buffer, size);
if (buffer != NULL)
- /* @r{Try again.} */
- snprintf (buffer, size, "value of %s is %s",
- name, value);
+ /* @r{Try again.} */
+ snprintf (buffer, size, "value of %s is %s",
+ name, value);
@}
/* @r{The last call worked, return the string.} */
return buffer;
@@ -2452,7 +2450,7 @@
@smallexample
#define myprintf(a, b, c, d, e, rest...) \
- printf (mytemplate , ## rest)
+ printf (mytemplate , ## rest)
@end smallexample
@noindent
@@ -2594,7 +2592,7 @@
@smallexample
void eprintf (const char *template, ...)
- __attribute__ ((format (printf, 1, 2)));
+ __attribute__ ((format (printf, 1, 2)));
@end smallexample
@noindent
@@ -2781,30 +2779,30 @@
int wanted;
if (argtypes[i] & PA_FLAG_PTR)
- wanted = STRUCTURE;
+ wanted = STRUCTURE;
else
- switch (argtypes[i] & ~PA_FLAG_MASK)
- @{
- case PA_INT:
- case PA_FLOAT:
- case PA_DOUBLE:
- wanted = NUMBER;
- break;
- case PA_CHAR:
- wanted = CHAR;
- break;
- case PA_STRING:
- wanted = STRING;
- break;
- case PA_POINTER:
- wanted = STRUCTURE;
- break;
- @}
+ switch (argtypes[i] & ~PA_FLAG_MASK)
+ @{
+ case PA_INT:
+ case PA_FLOAT:
+ case PA_DOUBLE:
+ wanted = NUMBER;
+ break;
+ case PA_CHAR:
+ wanted = CHAR;
+ break;
+ case PA_STRING:
+ wanted = STRING;
+ break;
+ case PA_POINTER:
+ wanted = STRUCTURE;
+ break;
+ @}
if (TYPE (args[i]) != wanted)
- @{
- error ("type mismatch for arg number %d", i);
- return 0;
- @}
+ @{
+ error ("type mismatch for arg number %d", i);
+ return 0;
+ @}
@}
return 1;
@}
@@ -2835,15 +2833,15 @@
@menu
* Registering New Conversions:: Using @code{register_printf_function}
- to register a new output conversion.
+ to register a new output conversion.
* Conversion Specifier Options:: The handler must be able to get
- the options specified in the
- template when it is called.
+ the options specified in the
+ template when it is called.
* Defining the Output Handler:: Defining the handler and arginfo
- functions that are passed as arguments
- to @code{register_printf_function}.
+ functions that are passed as arguments
+ to @code{register_printf_function}.
* Printf Extension Example:: How to define a @code{printf}
- handler function.
+ handler function.
* Predefined Printf Handlers:: Predefined @code{printf} handlers.
@end menu
@@ -3010,7 +3008,7 @@
@smallexample
int @var{function} (FILE *stream, const struct printf_info *info,
- const void *const *args)
+ const void *const *args)
@end smallexample
The @var{stream} argument passed to the handler function is the stream to
@@ -3058,7 +3056,7 @@
@smallexample
int @var{function} (const struct printf_info *info,
- size_t n, int *argtypes)
+ size_t n, int *argtypes)
@end smallexample
The return value from the function should be the number of arguments the
@@ -3728,7 +3726,7 @@
char *variable, *value;
if (2 > scanf ("%a[a-zA-Z0-9] = %a[^\n]\n",
- &variable, &value))
+ &variable, &value))
@{
invalid_input_error ();
return 0;
@@ -4781,10 +4779,10 @@
@menu
* String Streams:: Streams that get data from or put data in
- a string or memory buffer.
+ a string or memory buffer.
* Obstack Streams:: Streams that store data in an obstack.
* Custom Streams:: Defining your own streams with an arbitrary
- input data source and/or output data sink.
+ input data source and/or output data sink.
@end menu
@node String Streams
@@ -4958,9 +4956,9 @@
@menu
* Streams and Cookies:: The @dfn{cookie} records where to fetch or
- store data that is read or written.
+ store data that is read or written.
* Hook Functions:: How you should define the four @dfn{hook
- functions} that a custom stream needs.
+ functions} that a custom stream needs.
@end menu
@node Streams and Cookies
Modified: trunk/libc/misc/mntent_r.c
==============================================================================
--- trunk/libc/misc/mntent_r.c (original)
+++ trunk/libc/misc/mntent_r.c Fri May 13 08:10:17 2011
@@ -1,5 +1,5 @@
/* Utilities for reading/writing fstab, mtab, etc.
- Copyright (C) 1995-2000, 2001, 2002, 2003, 2006, 2010
+ Copyright (C) 1995-2000, 2001, 2002, 2003, 2006, 2010, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -263,8 +263,8 @@
mntcopy.mnt_type,
mntcopy.mnt_opts,
mntcopy.mnt_freq,
- mntcopy.mnt_passno)
- < 0 ? 1 : 0);
+ mntcopy.mnt_passno) < 0
+ || fflush (stream) != 0);
}
weak_alias (__addmntent, addmntent)
Modified: trunk/libc/nptl/ChangeLog
==============================================================================
--- trunk/libc/nptl/ChangeLog (original)
+++ trunk/libc/nptl/ChangeLog Fri May 13 08:10:17 2011
@@ -1,3 +1,8 @@
+2011-05-11 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #386]
+ * allocatestack.c (allocate_stack): Convert ENOMEM error to EAGAIN.
+
2011-04-10 Ulrich Drepper <drepper@xxxxxxxxx>
[BZ #12650]
Modified: trunk/libc/nptl/allocatestack.c
==============================================================================
--- trunk/libc/nptl/allocatestack.c (original)
+++ trunk/libc/nptl/allocatestack.c Fri May 13 08:10:17 2011
@@ -637,7 +637,7 @@
{
int err;
mprot_error:
- err = errno;
+ err = errno == ENOMEM ? EAGAIN : errno;
lll_lock (stack_cache_lock, LLL_PRIVATE);
Modified: trunk/libc/sysdeps/posix/spawni.c
==============================================================================
--- trunk/libc/sysdeps/posix/spawni.c (original)
+++ trunk/libc/sysdeps/posix/spawni.c Fri May 13 08:10:17 2011
@@ -143,9 +143,7 @@
}
else if ((flags & POSIX_SPAWN_SETSCHEDULER) != 0)
{
- if (__sched_setscheduler (0, attrp->__policy,
- (flags & POSIX_SPAWN_SETSCHEDPARAM) != 0
- ? &attrp->__sp : NULL) == -1)
+ if (__sched_setscheduler (0, attrp->__policy, &attrp->__sp) == -1)
_exit (SPAWN_ERROR);
}
#endif
Modified: trunk/ports/ChangeLog.mips
==============================================================================
--- trunk/ports/ChangeLog.mips (original)
+++ trunk/ports/ChangeLog.mips Fri May 13 08:10:17 2011
@@ -1,3 +1,11 @@
+2011-05-13 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/mips/dl-lookup.c: Update from generic version.
+
+2011-05-10 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * sysdeps/mips/dl-lookup.c: Update from generic version.
+
2011-04-11 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
* sysdeps/mips/dl-tls.h (TLS_DTV_UNALLOCATED): Define.
Modified: trunk/ports/sysdeps/mips/dl-lookup.c
==============================================================================
--- trunk/ports/sysdeps/mips/dl-lookup.c (original)
+++ trunk/ports/sysdeps/mips/dl-lookup.c Fri May 13 08:10:17 2011
@@ -211,7 +211,7 @@
might exist in more than one form
If the library does not provide symbol version information
- there is no problem at at: we simply use the symbol if it
+ there is no problem at all: we simply use the symbol if it
is defined.
These two lookups need to be handled differently if the
@@ -329,39 +329,21 @@
definition we have to use it. */
void enter (struct unique_sym *table, size_t size,
unsigned int hash, const char *name,
- const ElfW(Sym) *sym, struct link_map *map)
+ const ElfW(Sym) *sym, const struct link_map *map)
{
size_t idx = hash % size;
size_t hash2 = 1 + hash % (size - 2);
- while (1)
+ while (table[idx].name != NULL)
{
- if (table[idx].name == NULL)
- {
- table[idx].hashval = hash;
- table[idx].name = name;
- if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
- {
- table[idx].sym = ref;
- table[idx].map = undef_map;
- }
- else
- {
- table[idx].sym = sym;
- table[idx].map = map;
-
- if (map->l_type == lt_loaded)
- /* Make sure we don't unload this object by
- setting the appropriate flag. */
- map->l_flags_1 |= DF_1_NODELETE;
- }
-
- return;
- }
-
idx += hash2;
if (idx >= size)
idx -= size;
}
+
+ table[idx].hashval = hash;
+ table[idx].name = name;
+ table[idx].sym = sym;
+ table[idx].map = map;
}
struct unique_sym_table *tab
@@ -467,8 +449,19 @@
tab->free = free;
}
- enter (entries, size, new_hash, strtab + sym->st_name, sym,
- (struct link_map *) map);
+ if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
+ enter (entries, size, new_hash, strtab + sym->st_name, ref,
+ undef_map);
+ else
+ {
+ enter (entries, size, new_hash, strtab + sym->st_name, sym,
+ map);
+
+ if (map->l_type == lt_loaded)
+ /* Make sure we don't unload this object by
+ setting the appropriate flag. */
+ ((struct link_map *) map)->l_flags_1 |= DF_1_NODELETE;
+ }
++tab->n_elements;
__rtld_lock_unlock_recursive (tab->lock);