]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/uclibc/lib/contrib/uclibc/ldso/ldso/dl-elf.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / ldso / ldso / dl-elf.c
index 67aa5d990960213f3cf7024e31d73ceeff85fd5b..a63b997c31b32c623f8b5709d9eb8adfc2f18130 100644 (file)
@@ -469,7 +469,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
        DL_CHECK_LIB_TYPE (epnt, piclib, _dl_progname, libname);
 
        maxvma = (maxvma + ADDR_ALIGN) & PAGE_ALIGN;
-       minvma = minvma & ~0xffffU;
+       minvma = minvma & ~ADDR_ALIGN;
 
        flags = MAP_PRIVATE /*| MAP_DENYWRITE */ ;
        if (!piclib)
@@ -815,6 +815,54 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
                INIT_GOT(lpnt, tpnt);
        }
 
+#ifdef __DSBT__
+       /* Handle DSBT initialization */
+       {
+               struct elf_resolve *t, *ref = NULL;
+               int idx = tpnt->loadaddr.map->dsbt_index;
+               unsigned *dsbt = tpnt->loadaddr.map->dsbt_table;
+
+               if (idx == 0) {
+                       /* This DSO has not been assigned an index */
+                       _dl_dprintf(2, "%s: '%s' is missing a dsbt index assignment!\n",
+                                   _dl_progname, libname);
+                       _dl_exit(1);
+               }
+
+               /*
+                * Setup dsbt slot for this module in dsbt of all modules.
+                */
+               for (t = _dl_loaded_modules; t; t = t->next) {
+                       /* find a dsbt table from another module */
+                       if (ref == NULL && t != tpnt) {
+                               ref = t;
+
+                               /* make sure index is not already used */
+                               if (t->loadaddr.map->dsbt_table[idx]) {
+                                       struct elf_resolve *dup;
+                                       char *dup_name;
+
+                                       for (dup = _dl_loaded_modules; dup; dup = dup->next)
+                                               if (dup != tpnt && dup->loadaddr.map->dsbt_index == idx)
+                                                       break;
+                                       if (dup)
+                                               dup_name = dup->libname;
+                                       else if (idx == 1)
+                                               dup_name = "runtime linker";
+                                       else
+                                               dup_name = "unknown library";
+                                       _dl_dprintf(2, "%s: '%s' dsbt index %d already used by %s!\n",
+                                                   _dl_progname, libname, idx, dup_name);
+                                       _dl_exit(1);
+                               }
+                       }
+                       t->loadaddr.map->dsbt_table[idx] = (unsigned)dsbt;
+               }
+               if (ref)
+                       _dl_memcpy(dsbt, ref->loadaddr.map->dsbt_table,
+                                  tpnt->loadaddr.map->dsbt_size * sizeof(unsigned *));
+       }
+#endif
        _dl_if_debug_dprint("\n\tfile='%s';  generating link map\n", libname);
        _dl_if_debug_dprint("\t\tdynamic: %x  base: %x\n", dynamic_addr, DL_LOADADDR_BASE(lib_loadaddr));
        _dl_if_debug_dprint("\t\t  entry: %x  phdr: %x  phnum: %x\n\n",