]> sourceware.org Git - glibc.git/commitdiff
* locale/lc-ctype.c (_nl_postload_ctype): Add compat_symbol decls for
authorRoland McGrath <roland@gnu.org>
Wed, 18 Sep 2002 18:32:27 +0000 (18:32 +0000)
committerRoland McGrath <roland@gnu.org>
Wed, 18 Sep 2002 18:32:27 +0000 (18:32 +0000)
the __ctype_* compat symbols, so the relocs generated bind to the
right versioned global symbol in the shared object.

* elf/do-rel.h (elf_dynamic_do_rel): Mask off 0x8000 bit (hidden flag)
from the value taken from the DT_VERSYM table.
* elf/dl-runtime.c (fixup, profile_fixup): Likewise.
* sysdeps/mips/dl-machine.h (__dl_runtime_resolve): Likewise.
(RESOLVE_GOTSYM): Likewise.

ChangeLog
elf/dl-runtime.c
elf/do-rel.h
locale/lc-ctype.c
sysdeps/mips/dl-machine.h

index 063ec038ad23f27158014604d1335199e1d6d4bd..2ea9921893ba3871d73b44dda31e9aa0e99a01dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2002-09-18  Roland McGrath  <roland@redhat.com>
 
+       * locale/lc-ctype.c (_nl_postload_ctype): Add compat_symbol decls for
+       the __ctype_* compat symbols, so the relocs generated bind to the
+       right versioned global symbol in the shared object.
+
+       * elf/do-rel.h (elf_dynamic_do_rel): Mask off 0x8000 bit (hidden flag)
+       from the value taken from the DT_VERSYM table.
+       * elf/dl-runtime.c (fixup, profile_fixup): Likewise.
+       * sysdeps/mips/dl-machine.h (__dl_runtime_resolve): Likewise.
+       (RESOLVE_GOTSYM): Likewise.
+
        * sysdeps/unix/sysv/linux/sigaction.c (__libc_sigaction):
        Add libc_hidden_def.
        * sysdeps/unix/sysv/linux/arm/sigaction.c: Likewise.
index 9b24c3084143b3adad9e70e7f4d86cf8944e68e2..911c54159b437afbecd9b1b491c423dd27211e35 100644 (file)
@@ -84,7 +84,7 @@ fixup (
          {
            const ElfW(Half) *vernum =
              (const void *) D_PTR (l, l_info[VERSYMIDX (DT_VERSYM)]);
-           ElfW(Half) ndx = vernum[ELFW(R_SYM) (reloc->r_info)];
+           ElfW(Half) ndx = vernum[ELFW(R_SYM) (reloc->r_info) & 0x7fff];
            const struct r_found_version *version = &l->l_versions[ndx];
 
            if (version->hash != 0)
@@ -179,7 +179,7 @@ profile_fixup (
              {
                const ElfW(Half) *vernum =
                  (const void *) D_PTR (l,l_info[VERSYMIDX (DT_VERSYM)]);
-               ElfW(Half) ndx = vernum[ELFW(R_SYM) (reloc->r_info)];
+               ElfW(Half) ndx = vernum[ELFW(R_SYM) (reloc->r_info) & 0x7fff];
                const struct r_found_version *version = &l->l_versions[ndx];
 
                if (version->hash != 0)
index bad102549bef3906cc7e1bb7b5f9f56d163220e0..c693b6f1e8d7434a14e7de9dd26052028e41c528 100644 (file)
@@ -111,7 +111,7 @@ elf_dynamic_do_rel (struct link_map *map,
 
          for (; r < end; ++r)
            {
-             ElfW(Half) ndx = version[ELFW(R_SYM) (r->r_info)];
+             ElfW(Half) ndx = version[ELFW(R_SYM) (r->r_info)] & 0x7fff;
              elf_machine_rel (map, r, &symtab[ELFW(R_SYM) (r->r_info)],
                               &map->l_versions[ndx],
                               (void *) (l_addr + r->r_offset));
index ad815dfcbf22c37c7f4c4f1eb4dec4de25c533b3..eb108416d27a9a15415e5584d1d53b00d43ae41c 100644 (file)
@@ -27,6 +27,8 @@ _NL_CURRENT_DEFINE (LC_CTYPE);
 /* We are called after loading LC_CTYPE data to load it into
    the variables used by the ctype.h macros.  */
 
+
+
 void
 _nl_postload_ctype (void)
 {
@@ -65,6 +67,21 @@ _nl_postload_ctype (void)
   extern const uint32_t *__ctype32_toupper;
   extern const uint32_t *__ctype32_tolower;
 
+  /* We need the .symver declarations these macros generate so that
+     our references are explicitly bound to the versioned symbol names
+     rather than the unadorned names that are not exported.  When the
+     linker sees these bound to local symbols (as the unexported names are)
+     then it doesn't generate a proper relocation to the global symbols.
+     We need those relocations so that a versioned definition with a COPY
+     reloc in an executable will override the libc.so definition.  */
+
+compat_symbol (libc, __ctype_b, __ctype_b, GLIBC_2_0);
+compat_symbol (libc, __ctype_tolower, __ctype_tolower, GLIBC_2_0);
+compat_symbol (libc, __ctype_toupper, __ctype_toupper, GLIBC_2_0);
+compat_symbol (libc, __ctype32_b, __ctype32_b, GLIBC_2_0);
+compat_symbol (libc, __ctype32_tolower, __ctype32_tolower, GLIBC_2_2);
+compat_symbol (libc, __ctype32_toupper, __ctype32_toupper, GLIBC_2_2);
+
   __ctype_b = current (uint16_t, CLASS, 128);
   __ctype_toupper = current (uint32_t, TOUPPER, 128);
   __ctype_tolower = current (uint32_t, TOLOWER, 128);
index bc5e84fd86c441558d7120a41a5367015b6eba32..7dbdd794cf17e5099ff35048c10ebb8b86ec7423 100644 (file)
@@ -293,7 +293,7 @@ __dl_runtime_resolve (ElfW(Word) sym_index,                               \
          {                                                                   \
            const ElfW(Half) *vernum =                                        \
              (const void *) D_PTR (l, l_info[VERSYMIDX (DT_VERSYM)]);        \
-           ElfW(Half) ndx = vernum[sym_index];                               \
+           ElfW(Half) ndx = vernum[sym_index & 0x7fff];                      \
            const struct r_found_version *version = &l->l_versions[ndx];      \
                                                                              \
            if (version->hash != 0)                                           \
@@ -562,7 +562,7 @@ elf_machine_got_rel (struct link_map *map, int lazy)
     ({                                                                   \
       const ElfW(Sym) *ref = sym;                                        \
       const struct r_found_version *version                              \
-        = vernum ? &map->l_versions[vernum[sym_index]] : NULL;           \
+        = vernum ? &map->l_versions[vernum[sym_index] & 0x7fff] : NULL;          \
       ElfW(Addr) value;                                                          \
       value = RESOLVE (&ref, version, R_MIPS_REL32);                     \
       (ref)? value + ref->st_value: 0;                                   \
This page took 0.062606 seconds and 5 git commands to generate.