Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for global_ctor #446

Closed
gavrilikhin-d opened this issue Oct 30, 2023 · 4 comments
Closed

Add support for global_ctor #446

gavrilikhin-d opened this issue Oct 30, 2023 · 4 comments

Comments

@gavrilikhin-d
Copy link
Contributor

Need to initialize global variables with non-constant expressions.
This is usually done by using llvm's global_ctor array.
Can't find an API for using it in inkwell

@TheDan64
Copy link
Owner

Is there a llvm sys method for it?

@gavrilikhin-d
Copy link
Contributor Author

gavrilikhin-d commented Oct 30, 2023

Looks like LLVM doesn't expose append_to_global_ctors or append_to_global_dtors to C API.
https://llvm.org/doxygen/ModuleUtils_8h.html

So there is nothing in llvm sys too.

@gavrilikhin-d
Copy link
Contributor Author

gavrilikhin-d commented Oct 30, 2023

However, @llvm.global_ctors is a plain global variable, so it's still possible to create it manually
https://llvm.org/docs/LangRef.html#the-llvm-global-dtors-global-variable

@TheDan64
Copy link
Owner

Ok to close this issue then? Sounds like there's nothing we can do

@TheDan64 TheDan64 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants