Do you have a question? Post it now! No Registration Necessary
Subject
- Posted on
- Dr. Nikolaus Schaller
December 13, 2004, 6:19 pm

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
module.
Thanks to all who have given me support!
Nikolaus Schaller
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
module.
Thanks to all who have given me support!
Nikolaus Schaller

Re: SOLVED: rashing dlopen() on Sharp Zaurus C860

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.
HTH
--
Tauno Voipio
tauno voipio (at) iki fi
Tauno Voipio
tauno voipio (at) iki fi
Site Timeline
- » boot a OS from linux
- — Next thread in » Embedded Linux
-
- » c code or external app
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » Driver LED BP5131 - jak to dziaĆa?
- — The site's Newest Thread. Posted in » Electronics (Polish)
-
- » easy way to calibrate audio frequency generator?
- — The site's Last Updated Thread. Posted in » Electronics Repair
-