libera/#clasp - IRC Chatlog
Search
12:47:10
Colleen
Bike: drmeister said 7 hours, 5 minutes ago: How did you get it to build? I can't get it to build.
13:00:53
drmeister
I can build the interpreter and start compiling code but I get a weird runtime error that other people report.
13:01:33
drmeister
If we got this working we could build libunwind statically and link it statically - I think
13:02:13
Bike
i've been wondering if we can't just skip some of this and use the unw_ functions in whatever libunwind libgcc uses, if they exist
13:02:59
Bike
it's still a hassle. the build process is probably the worst part of clasp right now and i don't want to make it even worse
13:03:34
drmeister
It's not going to be worse. It's a few configuration switches. Let's just see if we can get this working and then decide.
13:04:07
drmeister
From the discord discussion there appears to be a bug in mixing clang with gcc libunwind - do you agree?
13:04:58
drmeister
Going all the way with llvm libunwind works on the mac and it almost works on linux except for this new problem.
13:05:45
drmeister
If the new problem is as bad as the bug with gcc libunwind/clang then we might be effed with clang and libunwind on linux.
13:37:29
drmeister
https://github.com/llvm/llvm-project/blob//llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp#L70
13:38:15
drmeister
Am I reading this correctly? llvm is compiled to use one libunwind on APPLE and another on linux.
13:42:27
drmeister
I can apply the patch to llvm and use the option and then see if that fixes the issue. That would be a PITA in the deploy script and we'd have to get a better solution in place for llvm13
13:50:26
drmeister
I made the changes to deploy to hack llvm to do this. If this works then we have options.
13:51:34
drmeister
It sounds like Di Bella is working on fixing the problem that clang doesn't like gnu libunwind? Is that your read? That would be the best thing.
13:55:02
drmeister
I'm building deploy on linux with code that patches llvm to add that option and then setting that option. Also, llvm libunwind is incorporated into /opt/clasp. Let's see if that works.
15:49:59
drmeister
Rebuilt deploy twice. I think the patch is active - but there's no difference in program behavior.
15:50:16
drmeister
Putting breakpoints on __unw_add_dynamic_fde and processFDE provide no illumination.
15:54:00
drmeister
Hmm, I can go into the deploy build directory and hack llvm directly, build and then install and it goes into /opt/clasp/
16:07:34
drmeister
Dammit - all this work because of that damn frame pointer elimination optimization.
18:08:26
drmeister
Ok, I see. So we walk the linked list of RBP and this checks if any given RBP is valid.
18:08:58
Bike
yeah, it's comparing against the value in the exception, which we get from llvm.frameaddress(0) i'm pretty sure
18:40:17
drmeister
So the only code that walks the stack to collect frame pointers is call_with_frame.
18:44:19
drmeister
If libunwind were working reliably I'd say we use it to walk the stack and get RBP for each frame within which it is available.
18:45:20
drmeister
What I mean is - do you see any problems with that idea other than the effed up libunwind situation that we talked about today.
18:45:46
Bike
i mean what i'd really ideally do is forget the stack pointer and get the local variable data from dwarf, but i guess llvm sucks at dwarf or something
18:46:01
drmeister
Right - dereferencing a builtin_frame_address or something that it points to is dangerous.
18:47:29
drmeister
The problem using libunwind is if we link with libunwind on linux that we run into the problems that we were talking about on discord. gnu libunwind doesn't work with clang code and llvm libunwind doesn't work with the JIT on linux.
18:50:25
drmeister
llvm optimizations wipe out a lot of DWARF info. function call arguments are the first to go.
18:50:52
drmeister
With a frame pointer and the stackmap entry for our register save area - we can get the call arguments.
18:52:33
Bike
it's essentially an extremely complex hack to work around llvm destroying things, which sucks