mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 10:50:07 +00:00
* elf/dl-load.c (_dl_map_object): Add MAP_INHERIT flag in mmap
from zero fill. * elf/dl-lookup.c (_dl_lookup_symbol): Take new flag arg NOSELF; if nonzero, don't let *REF satisfy the reference itself. * elf/link.h (_dl_lookup_symbol): Add new arg NOSELF in decl. * sysdeps/i386/dl-runtime.c (_dl_runtime_resolve): Pass new arg to _dl_lookup_symbol. * elf/do-rel.h (elf_dynamic_do_rel): Pass new second arg of R->r_offset to RESOLVE callback. * elf/dl-reloc.c (_dl_relocate_object: resolve): Don't let *REF satisfy the reference itself if its value equals the reloc's offset. * elf/rtld.c (dl_main): Write a newline in fatal msg. * Makerules (lib%.so: lib%_pic.a): Pass $(LDFLAGS.so).
This commit is contained in:
parent
5bf62f2d3a
commit
f2b0f935d7
18
ChangeLog
18
ChangeLog
@ -1,5 +1,23 @@
|
||||
Thu Jun 8 02:50:26 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* elf/dl-load.c (_dl_map_object): Add MAP_INHERIT flag in mmap
|
||||
from zero fill.
|
||||
|
||||
* elf/dl-lookup.c (_dl_lookup_symbol): Take new flag arg NOSELF;
|
||||
if nonzero, don't let *REF satisfy the reference itself.
|
||||
* elf/link.h (_dl_lookup_symbol): Add new arg NOSELF in decl.
|
||||
* sysdeps/i386/dl-runtime.c (_dl_runtime_resolve): Pass new arg to
|
||||
_dl_lookup_symbol.
|
||||
* elf/do-rel.h (elf_dynamic_do_rel): Pass new second arg of
|
||||
R->r_offset to RESOLVE callback.
|
||||
* elf/dl-reloc.c (_dl_relocate_object: resolve): Don't let *REF
|
||||
satisfy the reference itself if its value equals the reloc's
|
||||
offset.
|
||||
|
||||
* elf/rtld.c (dl_main): Write a newline in fatal msg.
|
||||
|
||||
* Makerules (lib%.so: lib%_pic.a): Pass $(LDFLAGS.so).
|
||||
|
||||
* elf/rtld.c [! NDEBUG] (__assert_perror_fail): New function.
|
||||
|
||||
* hurd/hurdstartup.c (_hurd_startup): Fancier kludge to guess phdr
|
||||
|
@ -355,10 +355,10 @@ ifeq (yes,$(build-shared))
|
||||
# $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
|
||||
# on other shared objects.
|
||||
lib%.so: lib%_pic.a
|
||||
$(LINK.o) -shared -o $@ -Wl,--whole-archive $< \
|
||||
$(LDFLAGS-$(notdir $*).so) \
|
||||
$(LINK.o) -shared -o $@ \
|
||||
$(LDFLAGS.so) $(LDFLAGS-$(notdir $*).so) \
|
||||
-L$(firstword $(objdir) .) -L$(common-objpfx:%/=%) \
|
||||
$(LDLIBS-$(notdir $*).so)
|
||||
$(LDLIBS-$(notdir $*).so) -Wl,--whole-archive $< \
|
||||
|
||||
# Don't try to use -lc when making libc.so itself.
|
||||
# Also omits crti.o and crtn.o, which we do not want
|
||||
|
@ -354,8 +354,8 @@ _dl_map_object (struct link_map *loader, const char *name,
|
||||
|
||||
if (zeroend > zeropage)
|
||||
/* Map the remaining zero pages in from the zero fill FD. */
|
||||
mapat = mmap (zeropage, zeroend - zeropage,
|
||||
prot, MAP_ANON|MAP_PRIVATE|MAP_FIXED,
|
||||
mapat = mmap (zeropage, zeroend - zeropage, prot,
|
||||
MAP_ANON|MAP_PRIVATE|MAP_FIXED|MAP_INHERIT,
|
||||
_dl_zerofd, 0);
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,15 @@ Cambridge, MA 02139, USA. */
|
||||
#include <assert.h>
|
||||
|
||||
/* Search loaded objects' symbol tables for a definition of
|
||||
the symbol UNDEF_NAME. Don't use a PLT defn in UNDEF_MAP, since
|
||||
that is the object making the reference. */
|
||||
the symbol UNDEF_NAME. If NOSELF is nonzero, then *REF
|
||||
cannot satisfy the reference itself; some different binding
|
||||
must be found. */
|
||||
|
||||
Elf32_Addr
|
||||
_dl_lookup_symbol (const char *undef_name, const Elf32_Sym **ref,
|
||||
struct link_map *symbol_scope,
|
||||
const char *reference_name)
|
||||
const char *reference_name,
|
||||
int noself)
|
||||
{
|
||||
unsigned long int hash = elf_hash (undef_name);
|
||||
struct link_map *map;
|
||||
@ -57,7 +59,9 @@ _dl_lookup_symbol (const char *undef_name, const Elf32_Sym **ref,
|
||||
{
|
||||
const Elf32_Sym *sym = &symtab[symidx];
|
||||
|
||||
if (sym->st_value == 0)
|
||||
if (sym->st_value == 0 || /* No value. */
|
||||
sym->st_shndx == SHN_UNDEF || /* PLT entry. */
|
||||
(noself && sym == *ref)) /* The reference can't define it. */
|
||||
continue;
|
||||
|
||||
switch (ELF32_ST_TYPE (sym->st_info))
|
||||
@ -71,12 +75,6 @@ _dl_lookup_symbol (const char *undef_name, const Elf32_Sym **ref,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sym->st_shndx == SHN_UNDEF)
|
||||
/* This is the same symbol we are looking for the value for.
|
||||
If it is a PLT entry, it will have a value of its own;
|
||||
but that is not what we are looking for. */
|
||||
continue;
|
||||
|
||||
if (sym != *ref && strcmp (strtab + sym->st_name, undef_name))
|
||||
/* Not the symbol we are looking for. */
|
||||
continue;
|
||||
|
@ -60,10 +60,10 @@ _dl_relocate_object (struct link_map *l, int lazy)
|
||||
= ((void *) l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);
|
||||
|
||||
|
||||
Elf32_Addr resolve (const Elf32_Sym **ref)
|
||||
Elf32_Addr resolve (const Elf32_Sym **ref, Elf32_Addr r_offset)
|
||||
{
|
||||
return _dl_lookup_symbol (strtab + (*ref)->st_name, ref, scope,
|
||||
l->l_name);
|
||||
l->l_name, (*ref)->st_value == r_offset);
|
||||
}
|
||||
|
||||
real_next = l->l_next;
|
||||
|
@ -37,7 +37,8 @@ Cambridge, MA 02139, USA. */
|
||||
static inline void
|
||||
elf_dynamic_do_rel (struct link_map *map,
|
||||
int reltag, int sztag,
|
||||
Elf32_Addr (*resolve) (const Elf32_Sym **),
|
||||
Elf32_Addr (*resolve) (const Elf32_Sym **symbol,
|
||||
Elf32_Addr r_offset),
|
||||
int lazy)
|
||||
{
|
||||
const Elf32_Sym *const symtab
|
||||
@ -61,7 +62,7 @@ elf_dynamic_do_rel (struct link_map *map,
|
||||
else
|
||||
{
|
||||
if (resolve)
|
||||
loadbase = (*resolve) (&definer);
|
||||
loadbase = (*resolve) (&definer, r->r_offset);
|
||||
else
|
||||
{
|
||||
assert (definer->st_shndx != SHN_UNDEF);
|
||||
|
@ -173,11 +173,14 @@ extern void _dl_setup_hash (struct link_map *map);
|
||||
reference; it is replaced with the defining symbol, and the base load
|
||||
address of the defining object is returned. SYMBOL_SCOPE is the head of
|
||||
the chain used for searching. REFERENCE_NAME should name the object
|
||||
containing the reference; it is used in error messages. */
|
||||
containing the reference; it is used in error messages. If NOSELF is
|
||||
nonzero, them *SYM itself cannot define the value; another binding must
|
||||
be found. */
|
||||
extern Elf32_Addr _dl_lookup_symbol (const char *undef,
|
||||
const Elf32_Sym **sym,
|
||||
struct link_map *symbol_scope,
|
||||
const char *reference_name);
|
||||
const char *reference_name,
|
||||
int noself);
|
||||
|
||||
|
||||
/* List of objects currently loaded. */
|
||||
|
@ -258,8 +258,8 @@ of this helper program; chances are you did not intend to run this program.\n",
|
||||
_dl_sysdep_fatal (_dl_argv[0] ?: "<program name unknown>",
|
||||
": error in loading shared libraries\n",
|
||||
errobj ?: "", errobj ? ": " : "",
|
||||
errstring, err ? ": " : NULL,
|
||||
err ? strerror (err) : NULL, NULL);
|
||||
errstring, err ? ": " : "",
|
||||
err ? strerror (err) : "", "\n", NULL);
|
||||
|
||||
/* Once we return, _dl_sysdep_start will invoke
|
||||
the DT_INIT functions and then *USER_ENTRY. */
|
||||
|
@ -64,7 +64,7 @@ _dl_runtime_resolve (Elf32_Word reloc_offset)
|
||||
|
||||
definer = &symtab[ELF32_R_SYM (reloc->r_info)];
|
||||
loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer,
|
||||
scope, l->l_name);
|
||||
scope, l->l_name, 0);
|
||||
|
||||
/* Restore list frobnication done above for DT_SYMBOLIC. */
|
||||
l->l_next = real_next;
|
||||
|
Loading…
Reference in New Issue
Block a user