This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I've added a new option -l to ldconfig to manually link shared libraries. Some packages did expect that option. Andreas 1999-12-17 Andreas Jaeger <aj@suse.de> * elf/ldconfig.c: Add new option -l to manualy link shared libraries. (options): Added option. (parse_opt): Set option. (main): Handle option. (manual_link): New function. ============================================================ Index: elf/ldconfig.c --- elf/ldconfig.c 1999/12/04 07:57:42 1.1 +++ elf/ldconfig.c 1999/12/17 08:51:20 @@ -97,6 +97,9 @@ /* Path to root for chroot. */ static char *opt_chroot; +/* Manually link given shared libraries. */ +static int opt_manual_link = 0; + /* Cache file to use. */ static const char *cache_file; @@ -119,6 +122,7 @@ { NULL, 'C', "CACHE", 0, N_("Use CACHE as cache file"), 0}, { NULL, 'f', "CONF", 0, N_("Use CONF as configuration file"), 0}, { NULL, 'n', NULL, 0, N_("Only process directories specified on the command line. Don't build cache."), 0}, + { NULL, 'l', NULL, 0, N_("Manually link individual libraries."), 0}, { NULL, 0, NULL, 0, NULL, 0 } }; @@ -148,6 +152,9 @@ case 'f': config_file = arg; break; + case 'l': + opt_manual_link = 1; + break; case 'N': opt_build_cache = 0; break; @@ -323,6 +330,75 @@ fputs ("\n", stdout); } +/* Manually link the given library. */ +static void +manual_link (char *library) +{ + char *path; + char *libname; + char *soname; + struct stat stat_buf; + int flag; + + /* Prepare arguments for create_links call. Split library name in + directory and filename first. Since path is allocated, we've got + to be careful to free at the end. */ + path = xstrdup (library); + libname = strrchr (path, '/'); + + if (libname) + { + /* Successfully split names. Check if path is just "/" to avoid + an empty path. */ + if (libname == path) + { + libname = library + 1; + path = xrealloc (path, 2); + strcpy (path, "/"); + } + else + { + *libname = '\0'; + ++libname; + } + } + else + { + /* There's no path, construct one. */ + libname = library; + path = xrealloc (path, 2); + strcpy (path, "."); + } + + /* Do some sanity checks first. */ + if (lstat (library, &stat_buf)) + { + error (0, errno, _("Can't lstat %s"), library); + free (path); + return; + } + /* We don't want links here! */ + else if (!S_ISREG (stat_buf.st_mode)) + { + error (0, 0, _("Ignored file %s since it is not a regular file."), + library); + free (path); + return; + } + libname = basename (library); + if (process_file (library, libname, &flag, &soname, 0)) + { + error (0, 0, _("No link created since soname could not be found for %s"), + library); + free (path); + return; + } + create_links (path, libname, soname); + free (soname); + free (path); +} + + /* Read a whole directory and search for libraries. The purpose is two-fold: - search for libraries which will be added to the cache @@ -595,8 +671,9 @@ /* Parse and process arguments. */ argp_parse (&argp, argc, argv, 0, &remaining, NULL); - /* Remaining arguments are additional libraries. */ - if (remaining != argc) + /* Remaining arguments are additional libraries if opt_manual_link + is not set. */ + if (remaining != argc && !opt_manual_link) { int i; for (i = remaining; i < argc; ++i) @@ -626,6 +703,18 @@ exit (0); } + if (opt_manual_link) + { + /* Link all given libraries manually. */ + int i; + + for (i = remaining; i < argc; ++i) + manual_link (argv [i]); + + exit (0); + } + + if (opt_build_cache) init_cache (); -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.rhein-neckar.de
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |