This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/60731] [4.7/4.8/4.9 Regression] dynamic library not getting reinitialized on multiple calls to dlopen()


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60731

Ondrej Bilka <neleai at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |neleai at seznam dot cz

--- Comment #9 from Ondrej Bilka <neleai at seznam dot cz> ---
I started to looking what STB_UNIQUE purpose is so I have several questions.

First does suggestion below really work?
http://gcc.gnu.org/ml/gcc-help/2011-05/msg00450.html

Say you have foo.so with unique symbol foo and function 

bar *getfoo() {
  return (void *) &foo;
}

which gets loaded and unloaded like

void *h = dlopen("foo.so",RTLD_NOW);
bar *p1 = dlsym(h,"getfoo")();
dlclose(h);
foo->baz();
h = dlopen("foo.so",RTLD_NOW);
bar *p2 = dlsym(h,"getfoo")();
dlclose(h);

Are p1 and p2 supposed to point to same object?
Also is foo->baz(); legal or not? If its so we cannot call destructors.

There could be fix to add zombie state where we call destructors but not free
memory so we can reinitialize object at same address but I need to know that
calling destructor is always intended behaviour.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]