Fix bogosities in cascade stuff.

This commit is contained in:
pk 1995-04-01 20:56:55 +00:00
parent 7e2dabf972
commit 28dba22b40
2 changed files with 58 additions and 84 deletions

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: rtld.c,v 1.30 1995/03/06 22:59:10 pk Exp $
* $Id: rtld.c,v 1.31 1995/04/01 20:56:55 pk Exp $
*/
#include <sys/param.h>
@ -125,10 +125,6 @@ struct somap_private {
#define LM_ETEXT(smp) ((char *) \
((smp)->som_addr + LM_TXTADDR(smp) + LD_TEXTSZ((smp)->som_dynamic)))
/* Needed shared objects */
#define LM_NEED(smp) ((struct sod *) \
((smp)->som_addr + LM_TXTADDR(smp) + LD_NEED((smp)->som_dynamic)))
/* PLT is in data segment, so don't use LM_OFFSET here */
#define LM_PLT(smp) ((jmpslot_t *) \
((smp)->som_addr + LD_PLT((smp)->som_dynamic)))
@ -1301,48 +1297,39 @@ dl_cascade(smp)
{
struct sod *sodp;
struct so_map *smp2;
long next;
sodp = LM_NEED(smp);
if ((char *) sodp < LM_ETEXT(smp))
{
struct so_map *smp2;
struct sod cas_sod;
next = LD_NEED(smp->som_dynamic);
for (;;)
{
cas_sod.sod_name = (long) (sodp->sod_name + LM_LDBASE(smp));
cas_sod.sod_library = sodp->sod_library;
cas_sod.sod_major = sodp->sod_major;
cas_sod.sod_minor = sodp->sod_minor;
if ((smp2 = map_object(&cas_sod, &dlmap)) == NULL)
{
while (next) {
sodp = (struct sod *)(LM_LDBASE(smp) + next);
if ((smp2 = map_object(sodp, smp)) == NULL) {
#ifdef DEBUG
xprintf("ld.so: map_object failed on cascaded %s %s (%d.%d): %s\n", cas_sod.sod_library ? "library" : "file", cas_sod.sod_name, cas_sod.sod_major, cas_sod.sod_minor, strerror(errno));
xprintf("ld.so: map_object failed on cascaded %s %s (%d.%d): %s\n",
smp->sod_library ? "library" : "file", smp->sod_name,
smp->sod_major, smp->sod_minor, strerror(errno));
#endif
dlerrno = errno;
return 0;
}
#if 0
/*
* XXX - this doesn't work for some reason. not
* at all sure why. -mrg
*/
if (dl_cascade(smp2) == 0)
return 0;
#endif
if (LM_PRIVATE(smp2)->spd_refcount++ == 0) {
LM_PRIVATE(smp2)->spd_flags |= RTLD_DL;
reloc_map(smp2);
reloc_copy(smp2);
init_map(smp2, ".init");
init_map(smp2, "_init");
}
if (!sodp->sod_next)
break;
sodp++;
dlerrno = errno;
return 0;
}
#if 0
/*
* XXX - this doesn't work for some reason. not
* at all sure why. -mrg
*/
if (dl_cascade(smp2) == 0)
return 0;
#endif
if (LM_PRIVATE(smp2)->spd_refcount++ == 0) {
LM_PRIVATE(smp2)->spd_flags |= RTLD_DL;
reloc_map(smp2);
reloc_copy(smp2);
init_map(smp2, ".init");
init_map(smp2, "_init");
}
next = sodp->sod_next;
}
return 1;
}

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: rtld.c,v 1.30 1995/03/06 22:59:10 pk Exp $
* $Id: rtld.c,v 1.31 1995/04/01 20:56:55 pk Exp $
*/
#include <sys/param.h>
@ -125,10 +125,6 @@ struct somap_private {
#define LM_ETEXT(smp) ((char *) \
((smp)->som_addr + LM_TXTADDR(smp) + LD_TEXTSZ((smp)->som_dynamic)))
/* Needed shared objects */
#define LM_NEED(smp) ((struct sod *) \
((smp)->som_addr + LM_TXTADDR(smp) + LD_NEED((smp)->som_dynamic)))
/* PLT is in data segment, so don't use LM_OFFSET here */
#define LM_PLT(smp) ((jmpslot_t *) \
((smp)->som_addr + LD_PLT((smp)->som_dynamic)))
@ -1301,48 +1297,39 @@ dl_cascade(smp)
{
struct sod *sodp;
struct so_map *smp2;
long next;
sodp = LM_NEED(smp);
if ((char *) sodp < LM_ETEXT(smp))
{
struct so_map *smp2;
struct sod cas_sod;
next = LD_NEED(smp->som_dynamic);
for (;;)
{
cas_sod.sod_name = (long) (sodp->sod_name + LM_LDBASE(smp));
cas_sod.sod_library = sodp->sod_library;
cas_sod.sod_major = sodp->sod_major;
cas_sod.sod_minor = sodp->sod_minor;
if ((smp2 = map_object(&cas_sod, &dlmap)) == NULL)
{
while (next) {
sodp = (struct sod *)(LM_LDBASE(smp) + next);
if ((smp2 = map_object(sodp, smp)) == NULL) {
#ifdef DEBUG
xprintf("ld.so: map_object failed on cascaded %s %s (%d.%d): %s\n", cas_sod.sod_library ? "library" : "file", cas_sod.sod_name, cas_sod.sod_major, cas_sod.sod_minor, strerror(errno));
xprintf("ld.so: map_object failed on cascaded %s %s (%d.%d): %s\n",
smp->sod_library ? "library" : "file", smp->sod_name,
smp->sod_major, smp->sod_minor, strerror(errno));
#endif
dlerrno = errno;
return 0;
}
#if 0
/*
* XXX - this doesn't work for some reason. not
* at all sure why. -mrg
*/
if (dl_cascade(smp2) == 0)
return 0;
#endif
if (LM_PRIVATE(smp2)->spd_refcount++ == 0) {
LM_PRIVATE(smp2)->spd_flags |= RTLD_DL;
reloc_map(smp2);
reloc_copy(smp2);
init_map(smp2, ".init");
init_map(smp2, "_init");
}
if (!sodp->sod_next)
break;
sodp++;
dlerrno = errno;
return 0;
}
#if 0
/*
* XXX - this doesn't work for some reason. not
* at all sure why. -mrg
*/
if (dl_cascade(smp2) == 0)
return 0;
#endif
if (LM_PRIVATE(smp2)->spd_refcount++ == 0) {
LM_PRIVATE(smp2)->spd_flags |= RTLD_DL;
reloc_map(smp2);
reloc_copy(smp2);
init_map(smp2, ".init");
init_map(smp2, "_init");
}
next = sodp->sod_next;
}
return 1;
}