freenode/#clasp - IRC Chatlog
Search
18:20:51
drmeister
I have a challenge with snapshot save/load. I need to link a lot of GC managed object that contain function pointers and vtable pointers to the absolute addresses of these objects when the snapshot is brought back to life.
18:21:22
drmeister
I've been wrestling with this for a couple of weeks - trying one thing or another and getting caught in some rabbit holes.
18:22:21
drmeister
I thought it was a list of all function/method pointers that I can't resolve using dladdr/dlsym. But there are virtual methods in there that I need to weed out. Hang on.
18:23:49
drmeister
virtual methods are not function pointers - they are small integers <1024. So I ignore them if (uintptr_t)functionPointer < 1024
18:27:31
drmeister
I've been wrestling with this for weeks and I got things working on linux - but in a way that I fear is a bit brittle.
18:27:47
drmeister
I expected worse problems on macOS - but it looks like I have less problems on macOS.
18:32:09
drmeister
I couldn't get dladdr/dlsym to work for certain addresses - I think for functions that have 'internal' linkage. So I did all sorts of backflips to parse ELF files and to figure out absolute addresses of symbols.
18:38:26
drmeister
The names are the clasp names - I call dladdr on the pointer and if I don't get anything back then it generates that message.
18:38:55
drmeister
If I do get something back I run the result through some other tests like "can I call dlsym on the name that dladdr returns" - and they all pass.