Print a warning message if we detect that a "copy symbol" has changed

size in a shared library.  Also, always use our expected size to copy
the item in, on the assumption that doing so generally minimizes the
damage (maybe it's better to just bail out?).
This commit is contained in:
pk 1998-02-17 23:07:33 +00:00
parent 81b7d9b217
commit 9084f293a7
2 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtld.c,v 1.52 1998/01/05 22:01:04 cgd Exp $ */ /* $NetBSD: rtld.c,v 1.53 1998/02/17 23:07:33 pk Exp $ */
/* /*
* Copyright (c) 1993 Paul Kranenburg * Copyright (c) 1993 Paul Kranenburg
@ -859,11 +859,18 @@ reloc_map(smp)
relocation -= (long)smp->som_addr; relocation -= (long)smp->som_addr;
if (RELOC_COPY_P(r) && src_map) { if (RELOC_COPY_P(r) && src_map) {
if (p->nz_size != np->nz_size)
warnx("symbol %s at %#x in %s changed "
"size: expected %d, actual %d\n",
sym,
src_map->som_addr + np->nz_value,
src_map->som_path,
p->nz_size, np->nz_size);
(void)enter_rts(sym, (void)enter_rts(sym,
(long)addr, (long)addr,
N_DATA + N_EXT, N_DATA + N_EXT,
src_map->som_addr + np->nz_value, src_map->som_addr + np->nz_value,
np->nz_size, src_map); p->nz_size, src_map);
continue; continue;
} }
md_relocate(r, relocation, addr, 0); md_relocate(r, relocation, addr, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtld.c,v 1.52 1998/01/05 22:01:04 cgd Exp $ */ /* $NetBSD: rtld.c,v 1.53 1998/02/17 23:07:33 pk Exp $ */
/* /*
* Copyright (c) 1993 Paul Kranenburg * Copyright (c) 1993 Paul Kranenburg
@ -859,11 +859,18 @@ reloc_map(smp)
relocation -= (long)smp->som_addr; relocation -= (long)smp->som_addr;
if (RELOC_COPY_P(r) && src_map) { if (RELOC_COPY_P(r) && src_map) {
if (p->nz_size != np->nz_size)
warnx("symbol %s at %#x in %s changed "
"size: expected %d, actual %d\n",
sym,
src_map->som_addr + np->nz_value,
src_map->som_path,
p->nz_size, np->nz_size);
(void)enter_rts(sym, (void)enter_rts(sym,
(long)addr, (long)addr,
N_DATA + N_EXT, N_DATA + N_EXT,
src_map->som_addr + np->nz_value, src_map->som_addr + np->nz_value,
np->nz_size, src_map); p->nz_size, src_map);
continue; continue;
} }
md_relocate(r, relocation, addr, 0); md_relocate(r, relocation, addr, 0);