From owner-freebsd-hackers Tue Jan 7 10:00:55 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id KAA01904 for hackers-outgoing; Tue, 7 Jan 1997 10:00:55 -0800 (PST) Received: from austin.polstra.com (austin.polstra.com [206.213.73.10]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id KAA01899 for ; Tue, 7 Jan 1997 10:00:53 -0800 (PST) Received: from austin.polstra.com (jdp@localhost) by austin.polstra.com (8.8.3/8.8.3) with ESMTP id KAA16413; Tue, 7 Jan 1997 10:00:06 -0800 (PST) Message-Id: <199701071800.KAA16413@austin.polstra.com> To: roberto@keltia.freenix.fr (Ollivier Robert) cc: hackers@freebsd.org Subject: Re: ld with -R weirdness In-reply-to: Your message of "Tue, 07 Jan 1997 07:02:23 +0100." References: <199701062345.PAA10680@austin.polstra.com> Date: Tue, 07 Jan 1997 10:00:06 -0800 From: John Polstra Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > For security reasons, LD_LIBRARY_PATH is ignored for setuid and setgid > > programs. > > Except that when I'm testing this, the program is not yet installed and > still belongs to me: OK, in that case LD_LIBRARY_PATH is not the problem. The problem is that you specified the library as "libperl.so.3.19" instead of "-lperl". > > If you specify the library name explicitly ("libperl.so.3.19"), it is > > recorded as a direct reference to that particular file, and no searching > > is done. Directories are searched only if you specify the library > > generically ("-lperl"). > > It is recorded in a wrong way IMHO > > Shared object dependencies: > -llibperl.so.3.19 version 0.0 > -lm version 2.0 > -lc version 3.0 > -lcrypt version 2.0 It is recorded correctly, but "ldd -v" is printing it out incorrectly. That is a bug in ldd. I'll fix it as soon as I have time. To help me remember, it might be a good idea to send a PR about it. > Even if it were recorded as libperl.so.3.19, it should be able to > find it with LD_LIBRARY_PATH no ? No. The linker distinguishes between libraries specified as "-lxxx" and libraries specified as file names. Each shared object dependency has a flag "sod_library" that is set only if the library was specified as "-lxxx". (See LINK(5) and "/usr/include/link.h".) The search rules are used only for those libraries. The others are interpreted as pathnames. If you want the dynamic linker to search for a library, you must specify it as "-lxxx". > > I should mention one other thing. If LD(1) is to be believed, there > > should be no space between ld's "-R" option and the > > "record-library-search-path" that follows it. (Just like the "-L" > > option.) You probably should remove the "," after "-Wl,-R". > > It seems to work the same way with and without the ','. Yes, but it you use it contrary to the manual page, there is no guarantee it will still work next week, or even tomorrow. -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Self-knowledge is always bad news." -- John Barth