Subject: port-alpha/18114: unaligned access + segfault when using dlfcn(3) on alpha
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bryan-spamtrap4@darkforest.org>
List: netbsd-bugs
Date: 08/30/2002 00:10:06
>Number:         18114
>Category:       port-alpha
>Synopsis:       unaligned access + segfault when using dlfcn(3) on alpha
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-alpha-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 30 00:11:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     B. James Phillippe
>Release:        NetBSD 1.5.4_ALPHA
>Organization:
-bp
--
# bryan_at_darkforest_dot_org
# Software Engineer
>Environment:
System: NetBSD jupiter 1.5.4_ALPHA NetBSD 1.5.4_ALPHA (Jupiter 20020825) #5: Sun Aug 25 15:50:04 PDT 2002 bryan@jupiter:/usr/src/1.5/src/sys/arch/alpha/compile/jupiter alpha
Architecture: alpha
Machine: alpha
>Description:
	Use of the run-time linker for shared objects seems to blow up on
	alpha.
>How-To-Repeat:
/*** create the following shared object ***/
/* Compile with: gcc -shared -o foo.so */
int dynsym(void)
{
    return 1;
}


/*** create the following executable ***/
#include <stdio.h>
#include <dlfcn.h>

int main(int argc, char *argv[])
{
    void *handle;
    int (*fptr)(void);

    if (!(handle = dlopen("./foo.so", RTLD_LAZY))) {
        printf("dlopen() failed: %s\n", dlerror());
        exit(1);
    }

    if (!(fptr = dlsym(handle, "dynsym"))) {
        printf("failed to find dynsym: %s\n", dlerror());
    }

    printf("Value of dynsym is %ld\n", fptr());

    dlclose(handle);

    return 0;
}
>Fix:
	Took a look, and this is beyond me.
>Release-Note:
>Audit-Trail:
>Unformatted: