From nobody@FreeBSD.org  Tue Nov 14 21:18:11 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 537D516A47E
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 14 Nov 2006 21:18:11 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 416A143D73
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 14 Nov 2006 21:18:04 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id kAELI46M088604
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 14 Nov 2006 21:18:04 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id kAELI4wq088603;
	Tue, 14 Nov 2006 21:18:04 GMT
	(envelope-from nobody)
Message-Id: <200611142118.kAELI4wq088603@www.freebsd.org>
Date: Tue, 14 Nov 2006 21:18:04 GMT
From: David Sanderson<dsanderson@panasas.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: on amd64, ldd produces bogus output for i386 executables
X-Send-Pr-Version: www-3.0

>Number:         105542
>Category:       bin
>Synopsis:       on amd64, ldd(1) produces bogus output for i386 executables
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-amd64
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 14 21:20:02 GMT 2006
>Closed-Date:    Mon Jun 23 14:31:09 UTC 2008
>Last-Modified:  Mon Jun 23 14:31:09 UTC 2008
>Originator:     David Sanderson
>Release:        FreeBSD 6.1 (amd64, i386)
>Organization:
Panasas
>Environment:
FreeBSD compute-6-29 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May  7 04:15:57 UTC 2006     root@bloom.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP  amd64

>Description:
The problem seems to be that ldd isn't setting LD_32_* environment variables
along with the LD_* environment variables that it already sets:

: compute-6-29; ldd /usr/pan/bin/tclsh8.3
ldd: /usr/pan/bin/tclsh8.3: can't read program header
ldd: /usr/pan/bin/tclsh8.3: not a dynamic executable
: compute-6-29; ldd32 /usr/pan/bin/tclsh8.3
        libtcl83.so => /usr/pan/lib/libtcl83.so (0x28077000)
        libm.so.4 => /usr/lib32/libm.so.4 (0x280fb000)
        libc.so.6 => /usr/lib32/libc.so.6 (0x28112000)
: compute-6-29; cat $HOME/scripts/ldd32
#!/bin/sh
#-------
# This lets us see what's going on with loading 32-bit shared objects
# on FreeBSD 6.
#-------
export LD_32_TRACE_LOADED_OBJECTS; LD_32_TRACE_LOADED_OBJECTS=1
exec "$@"

>How-To-Repeat:
Use ldd on a dynamically loaded i386 executable on an amd64 freebsd6
system.
>Fix:
The fix would presumably be to go through the ldd code and have it
set LD_32_* in addition to LD_*, for each LD_* variable it currently
sets.  Some adjustments to how ldd examines the program header may also
be necessary.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-amd64 
Responsible-Changed-By: remko 
Responsible-Changed-When: Wed Nov 28 13:15:03 UTC 2007 
Responsible-Changed-Why:  
Make this more visible in the amd64 queue 

http://www.freebsd.org/cgi/query-pr.cgi?pr=105542 
State-Changed-From-To: open->closed 
State-Changed-By: edwin 
State-Changed-When: Mon Jun 23 14:30:55 UTC 2008 
State-Changed-Why:  
A patch can be found in bin/124906 

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