Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 7635 - dlsym can't find objects in the case of dlopen(NULL, flag)
Summary: dlsym can't find objects in the case of dlopen(NULL, flag)
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 6.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-12-06 19:02 UTC by braddr
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2000-01-05 03:16:47 UTC

Attachments (Terms of Use)

Description braddr 1999-12-06 19:02:44 UTC
Unlike solaris, this program demonstrates that glibc has issues resolving
symbols to data elements.  I've tried it with glibc 2.0.7 and 2.1.2, both
with and without x being initialized:

#include <stdio.h>
#include <stdlib.h>

#include <dlfcn.h>

int x=1;

int main()
    void *handle = dlopen(NULL, RTLD_NOW);
    int *symbol = (int*)dlsym(handle, "x");
    char *errmsg = dlerror();

    printf("%d\n", x);

    if (symbol)
        printf("%d\n", *symbol);
        printf("error: %s\n", errmsg);
    return 0;

Comment 1 braddr 1999-12-06 22:47:59 UTC
Actually, it seems unable to locate any local symbols.. main, or if I add
another function it can't look up that one either.  It seems that
dlopen(NULL,blah) is what's broken possibly.

Comment 2 braddr 1999-12-13 19:27:59 UTC
change the sort desc to match the actual bug report

Comment 3 Cristian Gafton 2000-01-05 03:02:59 UTC
Yepp, this is a bug.

Comment 4 Cristian Gafton 2000-01-05 03:16:59 UTC
Oops, not really a bug. You need to pass -rdynamic at the link time to have this
fucntionality (you need to be able to access your own proram space like a shared

Note You need to log in before you can comment on or make changes to this bug.