Skip site navigation (1)Skip section navigation (2)
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
Message-ID:  <Mutt.19970105234525.roberto@keltia.freenix.fr>

next in thread | raw e-mail | index | archive | help
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



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