[flang-commits] [flang] [RFC][flang] Trampolines for internal procedures. (PR #66157)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Mon Sep 18 04:31:30 PDT 2023


kiranchandramohan wrote:

Thanks @vzakhari for proposing this solution for pointers to internal procedures. Form a quick read,
-> This primarily solves the security issues due to a writeable stack.
-> The runtime solution will work on platforms that currently do not support the llvm trampoline intrinsics.
-> The details of filling the trampoline area for each platform are yet to be worked out.

>  Clang uses some other method to make Lambda's and similar nested function calls work
@Leporacanthicus would you know what that is? Would analysing the code generated for the following c++ code help?
```
#include <iostream>
#include <functional>
using std::cout; 

int do_some_process(int x, std::function<int(int)> process)
{
    return process(x); 
}

int main() 
{
    int y;
    y = 20;
    std::function<int(int)> lambda = [&y](int x)->int{ return x*y;};
    cout << do_some_process(2, lambda) << "\n"; 
    return 0;
}
```

https://github.com/llvm/llvm-project/pull/66157


More information about the flang-commits mailing list