From owner-freebsd-hackers Sun Jan 5 14:46:49 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id OAA18238 for hackers-outgoing; Sun, 5 Jan 1997 14:46:49 -0800 (PST) Received: from mexico.brainstorm.eu.org (root@mexico.brainstorm.fr [193.56.58.253]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id OAA18233 for ; Sun, 5 Jan 1997 14:46:44 -0800 (PST) Received: from brasil.brainstorm.eu.org (brasil.brainstorm.fr [193.56.58.33]) by mexico.brainstorm.eu.org (8.8.4/8.8.4) with ESMTP id XAA02094 for ; Sun, 5 Jan 1997 23:46:40 +0100 Received: (from uucp@localhost) by brasil.brainstorm.eu.org (8.6.12/8.6.12) with UUCP id XAA28862 for freebsd-hackers@FreeBSD.ORG; Sun, 5 Jan 1997 23:46:23 +0100 Received: (from roberto@localhost) by keltia.freenix.fr (8.8.4/keltia-uucp-2.9) id XAA07787; Sun, 5 Jan 1997 23:45:26 +0100 (CET) Message-ID: Date: Sun, 5 Jan 1997 23:45:25 +0100 From: roberto@keltia.freenix.fr (Ollivier Robert) To: freebsd-hackers@FreeBSD.ORG (FreeBSD Hackers' list) Subject: ld with -R weirdness X-Mailer: Mutt 0.55.15 Mime-Version: 1.0 X-Operating-System: FreeBSD 3.0-CURRENT ctm#2837 Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk I'm the maintainer of the Perl5 hints file for freebsd and I tried to compile it with a shared libperl.so. I use -Wl,-R to gcc in order to give the linker to put the shared lib directory inside the executable. In suidperl case, the command line given to gcc (then ld) is the following: cc -L/usr/local/lib -Wl,-R,/usr/local/lib/perl5/i386-freebsd/5.00319/CORE -o suidperl perlmain.o sperl.o lib/auto/DynaLoader/DynaLoader.a libperl.so.3.19 `cat ext.libs` -lm -lc -lcrypt The problem is that afterward, ld.so is NOT able to find libperl.so.3.19... 608 [23:40] roberto@keltia:/build/perl5.003_10> ( cd lib ; ldd ../suidperl) ../suidperl: libperl.so.3.19 (0x0) -lm.2 => /usr/lib/libm.so.2.0 (0x8025000) -lc.3 => /usr/lib/libc.so.3.0 (0x803c000) -lcrypt.2 => /usr/lib/libcrypt.so.2.0 (0x80ad000) Even WITH LD_LIBRARY_PATH defined... 612 [23:44] roberto@keltia:/build/perl5.003_19> echo $LD_LIBRARY_PATH /work/build/perl5.003_19 When I patch the Makefile to have cc -L/usr/local/lib -Wl,-R,/usr/local/lib/perl5/i386-freebsd/5.00319/CORE -o suidperl perlmain.o sperl.o lib/auto/DynaLoader/DynaLoader.a -lperl `cat ext.libs` -lm -lc -lcrypt It works ! Looking inside the suidperl executable, I find the following weird strings: o/usr/local/lib/perl5/i386-freebsd/5.00319/CORE libperl.so.3.19 crypt Where does the 'o' before the path come from ? -- Ollivier ROBERT -=- The daemon is FREE! -=- roberto@keltia.freenix.fr FreeBSD keltia.freenix.fr 3.0-CURRENT #33: Sat Dec 21 12:57:17 CET 1996