Фотография
нажмите — покажем
нажмите — покажем
I fixed it!
The solution is that, llvm has an intrinsic global var for initializing lazily. Here is how it works:
@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @__cyrus_global_var_ctors, ptr null }]
It gets priority and a function pointer and runs automatically at program startup.
We could make this simply by having a simple function per module and calling all of the at main startup, but LLVM made it convenient and ready to use.
Thanks for everybody tried to help or participated in the discussion.