diff options
| author | Matthew Dillon <dillon@FreeBSD.org> | 2002-06-18 05:42:33 +0000 |
|---|---|---|
| committer | Matthew Dillon <dillon@FreeBSD.org> | 2002-06-18 05:42:33 +0000 |
| commit | eebf98659e0ea6038a324fc3b1bd33f22dd7c7f1 (patch) | |
| tree | b12c35e693d6856f2ca287d761c7cf80dc70ab70 /libexec/rtld-elf/alpha | |
| parent | a27ffb412ac669e0483ac0df8457ecd82ed198dd (diff) | |
Notes
Diffstat (limited to 'libexec/rtld-elf/alpha')
| -rw-r--r-- | libexec/rtld-elf/alpha/reloc.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/libexec/rtld-elf/alpha/reloc.c b/libexec/rtld-elf/alpha/reloc.c index 882a8ac0bdcd..4d9356c1f021 100644 --- a/libexec/rtld-elf/alpha/reloc.c +++ b/libexec/rtld-elf/alpha/reloc.c @@ -152,10 +152,18 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld) const Elf_Rela *relalim; const Elf_Rela *rela; SymCache *cache; + int bytes = obj->nchains * sizeof(SymCache); + int r = -1; - cache = (SymCache *)alloca(obj->nchains * sizeof(SymCache)); + /* + * The dynamic loader may be called from a thread, we have + * limited amounts of stack available so we cannot use alloca(). + */ + cache = mmap(NULL, bytes, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0); + if (cache == MAP_FAILED) + cache = NULL; if (cache != NULL) - memset(cache, 0, obj->nchains * sizeof(SymCache)); + memset(cache, 0, bytes); /* Perform relocations without addend if there are any: */ rellim = (const Elf_Rel *) ((caddr_t) obj->rel + obj->relsize); @@ -166,16 +174,20 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld) locrela.r_offset = rel->r_offset; locrela.r_addend = 0; if (reloc_non_plt_obj(obj_rtld, obj, &locrela, cache)) - return -1; + goto done; } /* Perform relocations with addend if there are any: */ relalim = (const Elf_Rela *) ((caddr_t) obj->rela + obj->relasize); for (rela = obj->rela; obj->rela != NULL && rela < relalim; rela++) { if (reloc_non_plt_obj(obj_rtld, obj, rela, cache)) - return -1; + goto done; } - return 0; + r = 0; +done: + if (cache) + munmap(cache, bytes); + return(r); } /* Process the PLT relocations. */ |
