turran wrote:

Hello @dschuff. Thanks for your comments.

> Or another random idea (for the "semi-transparently call with signature 
> mismatches" problem, not the "fix the bugs in my code" problem): What if we 
> represented function pointers (in the source) as being in a different address 
> space, using the existing `address_space(N)` clang/LLVM attributes? They 
> could be freely casted, written into memory and have the same integer values 
> as they otherwise would, but when you call through them, we could either use 
> a generic catch-all thunk like Binaryen's `fpcast-emu` pass does today, or 
> perhaps something more fancy, like a LUT check and a more-specific conversion 
> thunk. That could be feasible if e.g. the `FunctionPointer` C type and 
> `FUNCTION_POINTER` macro could be suitably redefined. Then we maybe wouldn't 
> need any changes to the code at callsites.

I'm not aware of what `address_space` does, but I understand it is something 
that would require a change in the original source code, which I think the 
approach should be transparent to the programmer.

About the LUT, isn't it similar to the approach commented on 
https://github.com/llvm/llvm-project/pull/153168#pullrequestreview-3122024433 
and replied on 
https://github.com/llvm/llvm-project/pull/153168#issuecomment-3212203688 ?

https://github.com/llvm/llvm-project/pull/153168
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to