On 5/7/21 5:49 PM, Mato Grin via Gcc-help wrote:
Hello, I would like to ask you for your help. We are creating a plugin, which is inserting some statements into compiled code. Plugin is working on GIMPLE representation. Under some conditions we need to stop execution of runnig code. We want to insert builin abort() function. It should be done with gimple_build_call (tree fn, unsigned nargs, ...) But we don't know how to create tree fn referencing abort() function. Could you help us, please? Or do you have some other or better idea how to stop runnig code? We were thinking about error trapping/throwing, but we couldn't find anything about this in documentation.
The path isolation pass (gcc/gimple-ssa-isolate-paths.c) inserts calls to __builtin_trap(), as does Address sanitizer (gcc/ubsan.c). The setup should be pretty much exactly the same as for __builtin_abort() so I'd follow those examples. Martin
Thanks in advance. Mato