The problem appears to be that optlink cannot deal correctly with weak references. I've modified the compiler to not emit weak references, and the problem goes away. It's not a perfect fix, but it works.