Skip to content

dlopen: Add support for LLVM-14 typed pointers #27645

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dlongnecke-cray
Copy link
Contributor

@dlongnecke-cray dlongnecke-cray commented Aug 13, 2025

This PR adds support for older versions of LLVM that require typed pointers (currently the only version of LLVM we support that uses typed pointers by default is LLVM-14).

When issuing an indirect call we usually pass in a void* storing the address of the local pointer. This PR just adds a bitcast instruction to the function pointer type when the macro HAVE_LLVM_TYPED_POINTERS is defined.

We already do a similar thing when calling vtable pointers, so I found inspiration there.

I tested this with LLVM-14 on linux64 with COMM=gasnet and COMM=none and all the procedure pointer tests seem to pass.

Reviewed by @jabraham17. Thanks!

@dlongnecke-cray dlongnecke-cray self-assigned this Aug 13, 2025
val = info->irBuilder->CreateBitCast(val, fnPtrType);
#endif

if (!fnType) INT_FATAL("Need function type to create indirect call");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably go before the call to getUnqual

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks.

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

Successfully merging this pull request may close these issues.

2 participants