mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-30 00:31:08 +00:00
Update.
* sysdeps/generic/dl-tls.c (_dl_determine_tlsoffset): More changes required by passing pointer to last element of the list. * elf/dl-load.c (_dl_map_object_from_fd): Move adjustment of l_tls_initimage to a place where it actually is performed. * elf/tls-macros.h: ...here. New file.
This commit is contained in:
parent
03af57939c
commit
a330abe2cd
@ -1,5 +1,11 @@
|
|||||||
2002-02-10 Ulrich Drepper <drepper@redhat.com>
|
2002-02-10 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/generic/dl-tls.c (_dl_determine_tlsoffset): More changes
|
||||||
|
required by passing pointer to last element of the list.
|
||||||
|
|
||||||
|
* elf/dl-load.c (_dl_map_object_from_fd): Move adjustment of
|
||||||
|
l_tls_initimage to a place where it actually is performed.
|
||||||
|
|
||||||
* sysdeps/generic/glob.c (glob): Explicitly set gl_pathc to zero
|
* sysdeps/generic/glob.c (glob): Explicitly set gl_pathc to zero
|
||||||
after globfree() calls.
|
after globfree() calls.
|
||||||
|
|
||||||
@ -17,7 +23,7 @@
|
|||||||
* elf/Makefile: Add rules to build and run nodlopen2.
|
* elf/Makefile: Add rules to build and run nodlopen2.
|
||||||
|
|
||||||
* elf/tst-tls1.c: Move TLS helper macros to...
|
* elf/tst-tls1.c: Move TLS helper macros to...
|
||||||
* elf/tls-macros.hgg: ...here. New file.
|
* elf/tls-macros.h: ...here. New file.
|
||||||
* elf/tst-tls2.c: New file.
|
* elf/tst-tls2.c: New file.
|
||||||
* elf/Makefile (tests): Add tst-tls2.
|
* elf/Makefile (tests): Add tst-tls2.
|
||||||
(distribute): Add tls-macros.h.
|
(distribute): Add tls-macros.h.
|
||||||
|
@ -1036,12 +1036,6 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
|||||||
l->l_map_start = c->mapstart + l->l_addr;
|
l->l_map_start = c->mapstart + l->l_addr;
|
||||||
l->l_map_end = l->l_map_start + maplength;
|
l->l_map_end = l->l_map_start + maplength;
|
||||||
|
|
||||||
#ifdef USE_TLS
|
|
||||||
/* Adjust the address of the TLS initialization image. */
|
|
||||||
if (l->l_tls_initimage != NULL)
|
|
||||||
l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_addr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (c < &loadcmds[nloadcmds])
|
while (c < &loadcmds[nloadcmds])
|
||||||
{
|
{
|
||||||
if (c->mapend > c->mapstart
|
if (c->mapend > c->mapstart
|
||||||
@ -1135,6 +1129,12 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
|||||||
(ElfW(Addr)) l->l_phdr += l->l_addr;
|
(ElfW(Addr)) l->l_phdr += l->l_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_TLS
|
||||||
|
/* Adjust the address of the TLS initialization image. */
|
||||||
|
if (l->l_tls_initimage != NULL)
|
||||||
|
l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_map_start;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* We are done mapping in the file. We no longer need the descriptor. */
|
/* We are done mapping in the file. We no longer need the descriptor. */
|
||||||
__close (fd);
|
__close (fd);
|
||||||
/* Signal that we closed the file. */
|
/* Signal that we closed the file. */
|
||||||
|
@ -79,16 +79,16 @@ _dl_next_tls_modid (void)
|
|||||||
|
|
||||||
void
|
void
|
||||||
internal_function
|
internal_function
|
||||||
_dl_determine_tlsoffset (struct link_map *firstp)
|
_dl_determine_tlsoffset (struct link_map *lastp)
|
||||||
{
|
{
|
||||||
struct link_map *runp = firstp;
|
struct link_map *runp;
|
||||||
size_t max_align = 0;
|
size_t max_align = 0;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
|
|
||||||
if (GL(dl_initimage_list) == NULL)
|
if (lastp == NULL)
|
||||||
{
|
{
|
||||||
/* None of the objects used at startup time uses TLS. We still
|
/* None of the objects used at startup time uses TLS. We still
|
||||||
have to allocate the TCB adn dtv. */
|
have to allocate the TCB and dtv. */
|
||||||
GL(dl_tls_static_size) = TLS_TCB_SIZE;
|
GL(dl_tls_static_size) = TLS_TCB_SIZE;
|
||||||
GL(dl_tls_static_align) = TLS_TCB_ALIGN;
|
GL(dl_tls_static_align) = TLS_TCB_ALIGN;
|
||||||
|
|
||||||
@ -99,6 +99,7 @@ _dl_determine_tlsoffset (struct link_map *firstp)
|
|||||||
/* We simply start with zero. */
|
/* We simply start with zero. */
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
|
runp = lastp->l_tls_nextimage;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
max_align = MAX (max_align, runp->l_tls_align);
|
max_align = MAX (max_align, runp->l_tls_align);
|
||||||
@ -110,7 +111,7 @@ _dl_determine_tlsoffset (struct link_map *firstp)
|
|||||||
negative offset. */
|
negative offset. */
|
||||||
runp->l_tls_offset = offset;
|
runp->l_tls_offset = offset;
|
||||||
}
|
}
|
||||||
while ((runp = runp->l_tls_nextimage) != firstp);
|
while ((runp = runp->l_tls_nextimage) != lastp->l_tls_nextimage);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* The thread descriptor (pointed to by the thread pointer) has its
|
/* The thread descriptor (pointed to by the thread pointer) has its
|
||||||
@ -126,27 +127,28 @@ _dl_determine_tlsoffset (struct link_map *firstp)
|
|||||||
|
|
||||||
GL(dl_tls_static_size) = offset + TLS_TCB_SIZE;
|
GL(dl_tls_static_size) = offset + TLS_TCB_SIZE;
|
||||||
# elif TLS_DTV_AT_TP
|
# elif TLS_DTV_AT_TP
|
||||||
struct link_map *lastp;
|
struct link_map *prevp;
|
||||||
|
|
||||||
/* The first block starts right after the TCB. */
|
/* The first block starts right after the TCB. */
|
||||||
offset = TLS_TCB_SIZE;
|
offset = TLS_TCB_SIZE;
|
||||||
max_align = runp->l_tls_align;
|
max_align = runp->l_tls_align;
|
||||||
|
runp = lastp->l_tls_nextimage;
|
||||||
runp->l_tls_offset = offset;
|
runp->l_tls_offset = offset;
|
||||||
lastp = runp;
|
prevp = runp;
|
||||||
|
|
||||||
while ((runp = runp->l_tls_nextimage) != firstp)
|
while ((runp = runp->l_tls_nextimage) != firstp)
|
||||||
{
|
{
|
||||||
max_align = MAX (max_align, runp->l_tls_align);
|
max_align = MAX (max_align, runp->l_tls_align);
|
||||||
|
|
||||||
/* Compute the offset of the next TLS block. */
|
/* Compute the offset of the next TLS block. */
|
||||||
offset = roundup (offset + lastp->l_tls_blocksize, runp->l_tls_align);
|
offset = roundup (offset + prevp->l_tls_blocksize, runp->l_tls_align);
|
||||||
|
|
||||||
runp->l_tls_offset = offset;
|
runp->l_tls_offset = offset;
|
||||||
|
|
||||||
lastp = runp;
|
prevp = runp;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL(dl_tls_static_size) = offset + lastp->l_tls_blocksize;
|
GL(dl_tls_static_size) = offset + prevp->l_tls_blocksize;
|
||||||
# else
|
# else
|
||||||
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
|
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
|
||||||
# endif
|
# endif
|
||||||
|
Loading…
Reference in New Issue
Block a user