Subject: Re: weird problems on sparc with loading cyrus-imapd21 IMAP extension for cyradm perl script
To: Stoned Elipot <seb@starfleet.univ-paris7.fr>
From: Greg A. Woods <woods@weird.com>
List: tech-pkg
Date: 10/01/2003 16:10:48
[ On Wednesday, October 1, 2003 at 10:22:24 (+0200), Stoned Elipot wrote: ]
> Subject: Re: weird problems on sparc with loading cyrus-imapd21 IMAP extension for cyradm perl script
>
> On Tue, Sep 30, 2003 at 04:08:18PM -0400, Greg A. Woods wrote:
> [SNIP]
> > Has anyone seen anything like this before?
> 
> I have. On sparc64.
> It is supposed to be solved by adding "perl -V:cccdlflags" while
> linking perl modules.
> Grep for PERL_CCCDLFLAGS in mail/cyrus-imapd*/patches/*.

Yes those changes are all still there.

As you no doubt know PERL_CCCDLFLAGS is just a really poor hack for
trying to ensure that whatever flags are needed to generate position
independent code are passed to the compiler when compiling any code to
be included in the dynamic loaded extension.

In this case the resulting setting after running ./configure is
PERL_CCCDLFLAGS"-DPIC -fPIC" and I can see those flags being used on
every compilation when building both the Cyrus IMAPD internal libraries
(used in IMAP.so) as well as the IMAP.o file itself.

Is there any easy way to tell for certain whether any given object file
was compiled with '-fPIC'?  Some files I've tested to not contain a
_GLOBAL_OFFSET_TABLE_ symbol even though they were compiled with
'-fPIC'.  The only indicator I've found that seems to be reliable so far
is that "objdump -r" will show undefined symbols from the .text section
as having type R_SPARC_WPLT30 when compiled with '-fPIC' and type
R_SPARC_WDISP30 when compiled normally.  Is this right?  Is this the
best way to check that all .o's used in creating the .so have been
compiled with '-fPIC'?

If this could be the issue then the problem may be with my libsasl2
libraries since at the moment I have only libsasl2.a.  However on i386
where "cyradm" works I also have only the static-only libsasl2.a and it
was most definitely not compiled with '-fPIC'.  Is '-fPIC' not
universally necessary on i386 for all objects in loadable modules?

$ ldd /opt/pkg/lib/perl5/site_perl/5.6.1/i386-netbsd/auto/Cyrus/IMAP/IMAP.so
/opt/pkg/lib/perl5/site_perl/5.6.1/i386-netbsd/auto/Cyrus/IMAP/IMAP.so:
         -lperl => /usr/pkg/lib/perl5/5.6.1/i386-netbsd/CORE/libperl.so
         -lssl.2 => /usr/lib/libssl.so.2
         -lcrypto.1 => /usr/lib/libcrypto.so.1
$ nm /opt/pkg/lib/perl5/site_perl/5.6.1/i386-netbsd/auto/Cyrus/IMAP/IMAP.so | fgrep sasl | head
00018744 T _is_sasl_server_active
000174d4 T _sasl_MD5Final
000173fc T _sasl_MD5Init
00017430 T _sasl_MD5Update
000147b0 T _sasl_add_string
00016314 T _sasl_alloc_utils
0002fed4 D _sasl_allocation_utils
000267e4 T _sasl_auxprop_free
0002683c T _sasl_auxprop_lookup
00027370 T _sasl_auxprop_verify_apop

-- 
						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>