Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Destructor segfault in armle-v7 cpp shared objects: (3 Items)
   
Destructor segfault in armle-v7 cpp shared objects  
I am encountering an issue and have provided a test case.

If I have a armle-v7 shared object that I load and unload with dlopen/dlclose that contains any sort of global object 
with a destructor, I get a seg fault after the dlclose.  The exact same code works fine on an 6.5 armle system.

The attached code and project have two different example that don't work, and one that does (where the destructor is 
removed).  atexit used in the so constuctor instead of a destructor also fails.

Complete code for shared object:
class SimpleClass
{
public:
	SimpleClass() {};
	~SimpleClass() {};
};
static SimpleClass gSimpleClass;

Complete code for executable linking .so above:

#include <dlfcn.h>
#include <iostream>

int main(int argc, char *argv[])
{
   void* pSimple = dlopen("/tmp/libsimple_g.so.1", RTLD_NOW );
   if( pSimple )
   {
	   int returnVal = dlclose( pSimple );
	   std::cerr << "dlclose return value = " <<  returnVal << std::endl;
   }
   else
   {
	   std::cerr << "Unable to open simple" << std::endl;
   }
   return 0;
}
Attachment: Compressed file CppSharedObjectIssue.zip 311.43 KB
Re: Destructor segfault in armle-v7 cpp shared objects  
Yes, this is a bug. GA patch addressing this problem is coming out very
soon. I'll update this post when it becomes available.


---
Aleksandar


On Tue, 2010-10-19 at 16:19 -0400, David Baker wrote:
> I am encountering an issue and have provided a test case.
> 
> If I have a armle-v7 shared object that I load and unload with
> dlopen/dlclose that contains any sort of global object with a
> destructor, I get a seg fault after the dlclose.  The exact same code
> works fine on an 6.5 armle system.
> 
> The attached code and project have two different example that don't
> work, and one that does (where the destructor is removed).  atexit
> used in the so constuctor instead of a destructor also fails.
> 
> Complete code for shared object:
> class SimpleClass
> {
> public:
>         SimpleClass() {};
>         ~SimpleClass() {};
> };
> static SimpleClass gSimpleClass;
> 
> Complete code for executable linking .so above:
> 
> #include <dlfcn.h>
> #include <iostream>
> 
> int main(int argc, char *argv[])
> {
>    void* pSimple = dlopen("/tmp/libsimple_g.so.1", RTLD_NOW );
>    if( pSimple )
>    {
>            int returnVal = dlclose( pSimple );
>            std::cerr << "dlclose return value = " <<  returnVal <<
> std::endl;
>    }
>    else
>    {
>            std::cerr << "Unable to open simple" << std::endl;
>    }
>    return 0;
> }
> 
> 
> 
> 
> _______________________________________________
> 
> General
> http://community.qnx.com/sf/go/post71351
> 
> 

Re: Destructor segfault in armle-v7 cpp shared objects  
Hello David,

GA patch that fixes this issue can be downloaded from here:

http://www.qnx.com/download/feature.html?programid=21666


Thank you,

Aleksandar



On Wed, 2010-10-20 at 08:41 -0400, Aleksandar Ristovski wrote:
> Yes, this is a bug. GA patch addressing this problem is coming out very
> soon. I'll update this post when it becomes available.
> 
> 
> ---
> Aleksandar
> 
> 
> On Tue, 2010-10-19 at 16:19 -0400, David Baker wrote:
> > I am encountering an issue and have provided a test case.
> > 
> > If I have a armle-v7 shared object that I load and unload with
> > dlopen/dlclose that contains any sort of global object with a
> > destructor, I get a seg fault after the dlclose.  The exact same code
> > works fine on an 6.5 armle system.
> > 
> > The attached code and project have two different example that don't
> > work, and one that does (where the destructor is removed).  atexit
> > used in the so constuctor instead of a destructor also fails.
> > 
> > Complete code for shared object:
> > class SimpleClass
> > {
> > public:
> >         SimpleClass() {};
> >         ~SimpleClass() {};
> > };
> > static SimpleClass gSimpleClass;
> > 
> > Complete code for executable linking .so above:
> > 
> > #include <dlfcn.h>
> > #include <iostream>
> > 
> > int main(int argc, char *argv[])
> > {
> >    void* pSimple = dlopen("/tmp/libsimple_g.so.1", RTLD_NOW );
> >    if( pSimple )
> >    {
> >            int returnVal = dlclose( pSimple );
> >            std::cerr << "dlclose return value = " <<  returnVal <<
> > std::endl;
> >    }
> >    else
> >    {
> >            std::cerr << "Unable to open simple" << std::endl;
> >    }
> >    return 0;
> > }
> > 
> > 
> > 
> > 
> > _______________________________________________
> > 
> > General
> > http://community.qnx.com/sf/go/post71351
> > 
> > 
>