1832915 Members
2862 Online
110048 Solutions
New Discussion

SIGBUS - BUS_ADRALN

 
kercan7478
New Member

SIGBUS - BUS_ADRALN

I'm building a DLL for HPUX. I've linked in -lunalign and call allow_unaligned_data_access() from one of the global constructors in the DLL.

Now this arrangment worked fine till now. Recently I recompiled the DLL with "-mt" as a first step towards making the DLL thread safe. For any application that I'm building using this dll, I do link in the pthreads library ahead of all others like the recommendation here: http://docs.hp.com/en/1896/pthreads.html.

However now I get these BUS_ADRALN. I tried recompiling the DLL with +u1 option to get 1 byte alignment (I know its a performance issue, I'm just trying different things out) - but that now causes SIGMAPERR SIGSEGV errors.

Kind of stumped now without a clue about what the issue could be. Any pointers would be appreciated. Thanks !
3 REPLIES 3
Dennis Handly
Acclaimed Contributor

Re: SIGBUS - BUS_ADRALN

The implementation on IPF uses the hardware and this is per thread. And is 100s of times faster than PA.

The implementation on PA uses signals and is per process.

You'll need to call allow_unaligned_data_access in each thread.

There is a solution that uses _pthread_callback_np. Search DSPP or see:
http://h21007.www2.hp.com/portal/download/mailinglist_archives/cxx-dev/cxx-dev.0701/0018.html
kercan7478
New Member

Re: SIGBUS - BUS_ADRALN


-- Just to clarify I am calling allow_unaligned_data_access from any thread that will be created
Dennis Handly
Acclaimed Contributor

Re: SIGBUS - BUS_ADRALN

>Just to clarify I am calling allow_unaligned_data_access from any thread that will be created

That should fix the problem. You also need to do this in the main thread.

>call allow_unaligned_data_access() from one of the global constructors in the shlib.

This won't do it for each thread. You must do it in each function that is passed to pthread_create.