diff options
author | peter <peter@FreeBSD.org> | 1996-10-01 01:22:51 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-10-01 01:22:51 +0000 |
commit | 84a69ec571fc69439f49a2a47d5963f49cf6488e (patch) | |
tree | 971c56261cf0f40cf9505ac3c935e0bbc707a2df /libexec/rtld-aout/shlib.c | |
parent | 23b2a82332a3d2e5a644b9b9476f24286d0889a3 (diff) | |
download | FreeBSD-src-84a69ec571fc69439f49a2a47d5963f49cf6488e.zip FreeBSD-src-84a69ec571fc69439f49a2a47d5963f49cf6488e.tar.gz |
Support for .weak (in addition to the N_INDR stab) for gcc/g++. Also deal
with the -R option and store the path in the dynamic header when specified.
The $LD_RUN_PATH environment variable is not checked yet.
While here, split up the code a bit more to enable more selective replacing
of GPL'ed components that are linked with ld.so with others.
Obtained from: NetBSD (mostly, the breakup is my fault)
Diffstat (limited to 'libexec/rtld-aout/shlib.c')
-rw-r--r-- | libexec/rtld-aout/shlib.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/libexec/rtld-aout/shlib.c b/libexec/rtld-aout/shlib.c index 9460d35..44e30f0 100644 --- a/libexec/rtld-aout/shlib.c +++ b/libexec/rtld-aout/shlib.c @@ -27,28 +27,26 @@ * (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: shlib.c,v 1.14 1996/01/13 00:14:53 jdp Exp $ + * $Id: shlib.c,v 1.15 1996/04/20 18:27:56 jdp Exp $ */ #include <sys/param.h> -#include <stdio.h> -#include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/file.h> #include <sys/time.h> +#include <a.out.h> +#include <ctype.h> +#include <dirent.h> #include <err.h> #include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> #include <string.h> -#include <ctype.h> -#include <dirent.h> -#include <a.out.h> -#include "ld.h" - -#ifdef SUNOS4 -char *strsep(); -#endif +#include <link.h> +#include "shlib.h" +#include "support.h" /* * Standard directories to search for files specified by -l. @@ -59,7 +57,7 @@ char *strsep(); /* * Actual vector of library search directories, - * including `-L'ed and LD_LIBARAY_PATH spec'd ones. + * including `-L'ed and LD_LIBRARY_PATH spec'd ones. */ char **search_dirs; int n_search_dirs; @@ -73,9 +71,14 @@ void add_search_dir(name) char *name; { + int n; + + for (n = 0; n < n_search_dirs; n++) + if (strcmp(search_dirs[n], name) == 0) + return; n_search_dirs++; search_dirs = (char **) - xrealloc(search_dirs, n_search_dirs * sizeof(char *)); + xrealloc(search_dirs, n_search_dirs * sizeof search_dirs[0]); search_dirs[n_search_dirs - 1] = strdup(name); } @@ -83,17 +86,16 @@ void add_search_path(path) char *path; { - register char *cp; + register char *cp, *dup; if (path == NULL) return; - /* Add search directories from `paths' */ - while ((cp = strsep(&path, ":")) != NULL) { + /* Add search directories from `path' */ + path = dup = strdup(path); + while ((cp = strsep(&path, ":")) != NULL) add_search_dir(cp); - if (path) - *(path-1) = ':'; - } + free(dup); } void |