SOLVED: rashing dlopen() on Sharp Zaurus C860

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Dear all,
I have found the reason. It is not really a bug in dlopen() but
something I would consider a weakness.
It turned out that -fPIC was missing when linking the libraries that
later failed.
Why this crashes *sometimes* and not always is someting I don't really
understand. And there *might* or *should* be a flag within an
executable file that tells if it was compiled -fPIC or not. And
dlopen() *should* complain if it can't properly relocate such a

Thanks to all who have given me support!

Nikolaus Schaller

Re: SOLVED: rashing dlopen() on Sharp Zaurus C860
Quoted text here. Click to load it

The PIC flag forces the compiler to generate position-independent
code. The non-PIC code may be mapped to the location the linker
guesses for it, or it may end up in a different location. In the
first caes it does not crash, in the second case it quite probably
will crash (the crash is not 100% sure, as much of the code may
happen to be position-independent, anyway).

Why are the shared libraries mapped to surprising addresses?

The shared libraries are used in different processes in different
combinations. There are simply too many shared libraries to allocate
an own address range to each, so they have to be mapped to the
free address space available with the process. This means that
when the library is used by many processes, it pretty probably
is run at different linear addresses at each process.



Tauno Voipio
tauno voipio (at) iki fi

Site Timeline