Subject: 1.6BETA_2 snapshot's cc / dlopen() ?
To: None <port-alpha@netbsd.org>
From: Ray Phillips <r.phillips@jkmrc.uq.edu.au>
List: port-alpha
Date: 07/19/2002 17:25:54
Dear NetBSD/alpha:

I have the 1.6BETA_2 snapshot from

ftp://ftp.netbsd.org/pub/NetBSD/arch/alpha/snapshot/20020618-1.6_BETA2/

running on a 3000/400 and have attempted to install perl 5.005_03 and 
perl 5.6.1 on it from source.  The former installs happily on 1.5.2 
but neither even finishes running Configure properly on 1.6.

I realise the response is likely to be "install from pkgsrc rather 
than from source," but perl is supposed to install on most unicies 
isn't it?  So I wonder if the failure indicates a problem with part 
of 1.6 such as its new compiler?  (I'm just guessing.)

The problem with Configure is one of its small test programs core 
dumps.  The message written to the screen when Configure is run in 
interactive mode is:

Checking whether your dlsym() needs a leading underscore ...
pid 18412 (fred): unaligned access: va=0x16001447c pc=0x1600144dc 
ra=0x16008caa8 sp=0x1fffffa68 op=ldq
Segmentation fault - core dumped

I'm not proficient in these matters, but have found Configure creates 
a shared library(?), dyna.so, from dyna.c [1] then compiles and runs 
fred.c [2] to see if it's possible to resolve dyna.so's single symbol.

By trial and error I found the core dump occurs when dlopen() is 
called.  Any suggestions why, please?


Ray



[1]
% cat dyna.c
fred () { }
%



[2]
% cat fred.c

#include <stdio.h>
#define I_DLFCN
#ifdef I_DLFCN
#include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
#else
#include <sys/types.h>
#include <nlist.h>
#include <link.h>
#endif

extern int fred() ;

int main()
{
     void * handle ;
     void * symbol ;
#ifndef RTLD_LAZY
     int mode = 1 ;
#else
     int mode = RTLD_LAZY ;
#endif
     handle = dlopen("./dyna.so", mode) ;
     if (handle == NULL) {
         printf ("1\n") ;
         fflush (stdout) ;
         exit(0);
     }
     symbol = dlsym(handle, "fred") ;
     if (symbol == NULL) {
         /* try putting a leading underscore */
         symbol = dlsym(handle, "_fred") ;
         if (symbol == NULL) {
             printf ("2\n") ;
             fflush (stdout) ;
             exit(0);
         }
         printf ("3\n") ;
     }
     else
         printf ("4\n") ;
     fflush (stdout) ;
     exit(0);
}
%