Cannot unload shared library
Original Reporter info from Mantis: cobines
-
Reporter name:
Original Reporter info from Mantis: cobines
- Reporter name:
Description:
After loading a shared library built with FPC, unloading it either crashes or freezes application.
Steps to reproduce:
I have attached an example simple library (exlib), and a small project that loads and unloads the library (loadlib).
I build exlib.lpr:
$ fpc -fPIC exlib.lpr
I build loadlib.lpr:
$ fpc loadlib.lpr
I try some other lib:
$ loadlib /lib/libc.so.6
Opening /lib/libc.so.6
OK. Now closing.
After close.
Close OK.
I try to load 'libexlib.so':
$ loadlib ./libexlib.so
Opening ./libexlib.so
ExLib Init
ExLib Main
OK. Now closing.
ExLib Final
$
The program stopped between :
OK. Now closing.
and
After close.
Run in gdb:
$ gdb loadlib
(gdb) set args ./libexlib.so
(gdb) run
Starting program: /home/devel/loadlib ./libexlib.so
Opening ./libexlib.so
ExLib Init
ExLib Main
OK. Now closing.
ExLib Final
Program exited normally.
(gdb)
No visible crash, it just quits.
Do I build the library wrong?
I made a simple library in C, and it load and unloads ok with loadlib.
If I use FPC 2.2.4, the exlib loads and unloads OK (although it doesn't output any text).
I have binutils 2.20.
FPC is 2.5.1 rev. 13987. I build it with make OPT="-g -gl".
Mantis conversion info:
- Mantis ID: 14958
- OS: GNU/Linux Debian Unstable i386
- Build: 13987
- Version: 2.5.1
- Fixed in version: 2.6.0
- Fixed in revision: 16418 (#1f61b5b3)