shared library

Igor Lesik curoles at yahoo.com
Fri Mar 5 04:50:29 PST 2010


I was able to build D runtime shared library (.so). The test app dies with 
segmentation fault, I am debugging it; decided to share.

To reproduce my results one can load makefile from here:
http://www.curoles.com/j/dso/so.mak
(drop it into the runtime directory and call make -f so.mak)

The problem happens in main() (defined in src/rt/dmain2.d) when first time a 
library function is called.
The PLT entry look good, but jump to GOT seems to be wrong. I expect to see 
address of got.plt section
(readelf -S ./test), instead the address for indirect jump is taken from 
some stack variable, the address
is invalid and segmentation fault happens.

I have written some notes here (gdb session):
http://www.curoles.com/j/dso/dso.html

Igor






More information about the Digitalmars-d mailing list