From mi@misha.cisco.com Fri Jun 18 12:56:01 1999
Return-Path: <mi@misha.cisco.com>
Received: from misha.cisco.com (misha.cisco.com [171.69.206.50])
	by hub.freebsd.org (Postfix) with ESMTP id C024C15079
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 18 Jun 1999 12:55:59 -0700 (PDT)
	(envelope-from mi@misha.cisco.com)
Received: (from mi@localhost)
	by misha.cisco.com (8.9.3/8.9.1) id PAA21360;
	Fri, 18 Jun 1999 15:55:59 -0400 (EDT)
	(envelope-from mi)
Message-Id: <199906181955.PAA21360@misha.cisco.com>
Date: Fri, 18 Jun 1999 15:55:59 -0400 (EDT)
From: Mikhail Teterin <mi@misha.cisco.com>
Reply-To: mi@aldan.algebra.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: LD_IGNORE_MISSING_OBJECTS not honored for ELF binaries
X-Send-Pr-Version: 3.2

>Number:         12280
>Category:       bin
>Synopsis:       LD_IGNORE_MISSING_OBJECTS not honored for ELF binaries
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jdp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 18 13:00:00 PDT 1999
>Closed-Date:    Sat Nov 09 11:23:35 PST 2002
>Last-Modified:  Sat Nov 09 11:23:35 PST 2002
>Originator:     Mikhail Teterin
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
Virtual Estates, Inc.
>Environment:

>Description:

	See  Synopsis.  Additionally,  ld-elf.so.?  lacks  the  man-page.
	ld.so's   man   page   descirbes    a   number   of   environment
	variables  affecting the  runtime  linker's behaviour,  including
	LD_IGNORE_MISSING_OBJECTS.

>How-To-Repeat:

	strings /usr/libexec/ld-elf.so.1 | grep LD_IGNORE_MISSING_OBJECTS

>Fix:

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->jdp 
Responsible-Changed-By: msmith 
Responsible-Changed-When: Wed Jun 23 20:01:56 PDT 1999 
Responsible-Changed-Why:  
This may be a toolchain documentation issue, but requires input from our  
toolchain meister. 
State-Changed-From-To: open->closed 
State-Changed-By: jdp 
State-Changed-When: Tue Oct 3 21:04:30 PDT 2000 
State-Changed-Why:  
LD_IGNORE_MISSING_OBJECTS was a pretty nasty hack which I have 
always regretted adding to the a.out dynamic linker.  Rather than 
perpetuate it in the ELF dynamic linker, I would prefer that those 
who need it find some other solution.  One possibility would be to 
make an empty shared library and provide symbolic links to it under 
the names of the missing libraries.  An empty ELF shared library 
is fairly small -- about 2260 bytes on disk. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=12280 
State-Changed-From-To: closed->open 
State-Changed-By: jdp 
State-Changed-When: Fri Oct 6 10:06:01 PDT 2000 
State-Changed-Why:  
As the maintainer of the dynamic linker I do not like the requested 
feature, and I have no interest in implementing it myself. 
Nevertheless, I offered to the submitter in private mail that if 
I were given a full implementation (including man page changes) in 
the form of patches, I would review it and commit it if it was 
acceptable.  The submitter declines to take me up on that offer 
but requests that I re-open the PR in case someone else wishes to 
implement the feature.  Hence I am re-opening it and transferring 
responsibility back to bugs@freebsd.org.  Please do not assign it 
back to me unless patches are attached. 


Responsible-Changed-From-To: jdp->bugs 
Responsible-Changed-By: jdp 
Responsible-Changed-When: Fri Oct 6 10:06:01 PDT 2000 
Responsible-Changed-Why:  
See the explanation for re-opening the PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=12280 
Responsible-Changed-From-To: bugs->freebsd-bugs 
Responsible-Changed-By: billf 
Responsible-Changed-When: Fri Oct 6 11:41:37 PDT 2000 
Responsible-Changed-Why:  
Cosmetics so multiple reports aren't generated. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=12280 
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Sun Jan 20 10:04:04 PST 2002 
State-Changed-Why:  

What was the conclusion here - can this PR be closed? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=12280 

From: Ian Dowse <iedowse@maths.tcd.ie>
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: bin/12280: LD_IGNORE_MISSING_OBJECTS not honored for ELF binaries 
Date: Mon, 21 Jan 2002 21:11:43 +0000

 Adding to the audit trail:
 
 In message <200201210315.g0L3FcQ07050@aldan.algebra.com>, Mikhail Teterin write
 s:
 >On 20 Jan, iedowse@FreeBSD.org wrote:
 >> Synopsis: LD_IGNORE_MISSING_OBJECTS not honored for ELF binaries
 >
 >Well, that's still the  case. It would seem to me,  it should stay open,
 >until someone implements  the missing feature -- it  is useful sometimes
 >and is already documented :-)
 >
 >	-mi
 > 
 >> State-Changed-From-To: open->feedback
 >> State-Changed-By: iedowse
 >> State-Changed-When: Sun Jan 20 10:04:04 PST 2002
 >> State-Changed-Why: 
 >> 
 >> What was the conclusion here - can this PR be closed?
 >> 
 >> http://www.FreeBSD.org/cgi/query-pr.cgi?pr=12280
 >
 >
State-Changed-From-To: feedback->suspended 
State-Changed-By: iedowse 
State-Changed-When: Mon Jan 21 13:21:05 PST 2002 
State-Changed-Why:  

Awaiting implementation. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=12280 

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
 <------------------------->
State-Changed-From-To: suspended->open 
State-Changed-By: sheldonh 
State-Changed-When: Tue Jan 29 07:05:04 PST 2002 
State-Changed-Why:  
Patch submitted. 


Responsible-Changed-From-To: freebsd-bugs->jdp 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Tue Jan 29 07:05:04 PST 2002 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=12280 
State-Changed-From-To: open->closed 
State-Changed-By: jdp 
State-Changed-When: Sat Nov 9 11:22:40 PST 2002 
State-Changed-Why:  
Sorry, but I do not plan to support LD_IGNORE_MISSING_OBJECTS for 
ELF.  I consider that feature to have been a bad idea. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=12280 
>Unformatted:

 I don't believe that ld-elf.so is meant to honour this option; it's 
 strictly an option for the a.out ld.so.

