Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jan 2002 23:20:01 -0800 (PST)
From:      "Alexey V. Neyman" <alex.neyman@auriga.ru>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/12280: LD_IGNORE_MISSING_OBJECTS not honored for ELF binarie
Message-ID:  <200201230720.g0N7K1j67300@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/12280; it has been noted by GNATS.

From: "Alexey V. Neyman" <alex.neyman@auriga.ru>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/12280: LD_IGNORE_MISSING_OBJECTS not honored for ELF binarie
Date: Wed, 23 Jan 2002 10:13:53 +0300

 FWIW, here is the patch.
 (man page changes are mostly taken from rtld.1aout man page)
 
 diff -urN /usr/src/libexec/rtld-elf/rtld.1 rtld-elf/rtld.1
 --- /usr/src/libexec/rtld-elf/rtld.1	Thu Aug 16 14:44:20 2001
 +++ rtld-elf/rtld.1	Wed Jan 23 09:54:07 2002
 @@ -94,6 +94,33 @@
  .Ev LD_BIND_NOW
  increases the start-up time of a program, but it avoids run-time
  surprises caused by unexpectedly undefined functions.
 +.It Ev LD_IGNORE_MISSING_OBJECTS
 +When set to a nonempty string, makes it a nonfatal condition if one
 +or more required shared objects cannot be loaded.  Loading and
 +execution proceeds using the objects that are available.  A warning
 +is produced for each missing object, unless the environment variable
 +.Ev LD_SUPPRESS_WARNINGS
 +is set to a nonempty string. This is ignored for set-user-ID and
 +set-group-ID programs.
 +.Pp
 +Missing shared objects can be ignored without errors if all the
 +following conditions are met:
 +.Bl -bullet
 +.It
 +They do not supply definitions for any required data symbols.
 +.It
 +No functions defined by them are called during program execution.
 +.It
 +The environment variable
 +.Ev LD_BIND_NOW
 +is unset or is set to the empty string.
 +.El
 +.It Ev LD_SUPPRESS_WARNINGS
 +When set to a nonempty string,
 +.Nm
 +will not emit warning messages about missing shared objects if
 +.Ev LD_IGNORE_MISSING_OBJECTS
 +is also set to non-empty string.
  .It Ev LD_TRACE_LOADED_OBJECTS
  When set to a nonempty string, causes
  .Nm
 diff -urN /usr/src/libexec/rtld-elf/rtld.c rtld-elf/rtld.c
 --- /usr/src/libexec/rtld-elf/rtld.c	Fri May 11 04:57:20 2001
 +++ rtld-elf/rtld.c	Wed Jan 23 09:23:17 2002
 @@ -131,6 +131,8 @@
  static char *ld_preload;	/* Environment variable for libraries to
  				   load first */
  static char *ld_tracing;	/* Called from ldd to print libs */
 +static char *ld_ignore_missing;	/* Do not bail out if an object is not 
 found */
 +static char *ld_suppress_warns;	/* Do not give warnings */
  static Obj_Entry *obj_list;	/* Head of linked list of shared objects */
  static Obj_Entry **obj_tail;	/* Link field of last object in list */
  static Obj_Entry *obj_main;	/* The main program shared object */
 @@ -287,7 +289,9 @@
  	ld_debug = getenv("LD_DEBUG");
  	ld_library_path = getenv("LD_LIBRARY_PATH");
  	ld_preload = getenv("LD_PRELOAD");
 +	ld_ignore_missing = getenv("LD_IGNORE_MISSING_OBJECTS");
      }
 +    ld_suppress_warns = getenv("LD_SUPPRESS_WARNINGS");
      ld_tracing = getenv("LD_TRACE_LOADED_OBJECTS");
  
      if (ld_debug != NULL && *ld_debug != '\0')
 @@ -1062,8 +1066,15 @@
  	    char *path = find_library(name, obj);
  
  	    needed->obj = NULL;
 -	    if (path == NULL && !ld_tracing)
 -		return -1;
 +	    if (path == NULL) {
 +		if (ld_ignore_missing != NULL && *ld_ignore_missing != '\0') {
 +		    if (ld_suppress_warns == NULL || *ld_suppress_warns == '\0')
 +			warnx("warning: %s", dlerror());
 +		    continue;
 +		}
 +		if (!ld_tracing)
 +		    return -1;
 +	    }
  
  	    if (path) {
  		needed->obj = load_object(path);
 
 -- 
 <------------------------->
  ) May the Sun and Water (   Regards, Alexey V. Neyman
  ) always fall upon you! (   mailto:alex.neyman@auriga.ru
 <------------------------->

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201230720.g0N7K1j67300>