From 4836768df76d3919451aa9f847182c8f5f4068e7 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 3 Jul 2001 06:22:20 +0000 Subject: Allow the shared lib loader to fallback on the builddir if everything else fails. Let -uclibc-gcc --uclibc-use-build-dir set the shared lib loader to the one in the builddir's path. -Erik --- ldso/ldso/Makefile | 2 +- ldso/ldso/dl-elf.c | 13 +++++++++++++ ldso/ldso/readelflib1.c | 13 +++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) (limited to 'ldso') diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile index 35f383881..7128b0185 100644 --- a/ldso/ldso/Makefile +++ b/ldso/ldso/Makefile @@ -29,7 +29,7 @@ TARGET_CFLAGS += #-DDL_DEBUG #-funroll-loops LDSO_FULLNAME=ld-uclibc-$(MAJOR_VERSION).$(MINOR_VERSION).so -TARGET_CFLAGS+=-fPIC -D__PIC__ -DUCLIBC_ROOT_DIR=\"$(ROOT_DIR)\" +TARGET_CFLAGS+=-fPIC -D__PIC__ -DUCLIBC_ROOT_DIR=\"$(ROOT_DIR)\" -DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR); pwd)\" CSRC= boot1.c hash.c readelflib1.c vsprintf.c $(TARGET_ARCH)/elfinterp.c COBJS=$(patsubst %.c,%.o, $(CSRC)) ASRC=$(shell ls $(TARGET_ARCH)/*.S) diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index c1a4a41ee..4e1de140e 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -274,6 +274,19 @@ struct elf_resolve *_dl_load_shared_library(int secure, if (tpnt1) return tpnt1; + /* Bummer. Nothing so far. Check in /lib */ + pnt1 = UCLIBC_BUILD_DIR "/lib/"; + pnt = mylibname; + while (*pnt1) + *pnt++ = *pnt1++; + pnt1 = libname; + while (*pnt1) + *pnt++ = *pnt1++; + *pnt++ = 0; + tpnt1 = _dl_load_elf_shared_library(secure, mylibname, 0); + if (tpnt1) + return tpnt1; + goof: /* Well, we shot our wad on that one. All we can do now is punt */ if (_dl_internal_error_number) diff --git a/ldso/ldso/readelflib1.c b/ldso/ldso/readelflib1.c index c1a4a41ee..4e1de140e 100644 --- a/ldso/ldso/readelflib1.c +++ b/ldso/ldso/readelflib1.c @@ -274,6 +274,19 @@ struct elf_resolve *_dl_load_shared_library(int secure, if (tpnt1) return tpnt1; + /* Bummer. Nothing so far. Check in /lib */ + pnt1 = UCLIBC_BUILD_DIR "/lib/"; + pnt = mylibname; + while (*pnt1) + *pnt++ = *pnt1++; + pnt1 = libname; + while (*pnt1) + *pnt++ = *pnt1++; + *pnt++ = 0; + tpnt1 = _dl_load_elf_shared_library(secure, mylibname, 0); + if (tpnt1) + return tpnt1; + goof: /* Well, we shot our wad on that one. All we can do now is punt */ if (_dl_internal_error_number) -- cgit v1.2.3