case BUILT_IN_ADJUST_DESCRIPTOR:
return expand_builtin_adjust_descriptor (exp);
+ case BUILT_IN_GCC_NESTED_PTR_CREATED:
+ case BUILT_IN_GCC_NESTED_PTR_DELETED:
+ break; /* At present, no expansion, just call the function. */
+
case BUILT_IN_FORK:
case BUILT_IN_EXECL:
case BUILT_IN_EXECV:
DEF_BUILTIN_STUB (BUILT_IN_INIT_DESCRIPTOR, "__builtin_init_descriptor")
DEF_BUILTIN_STUB (BUILT_IN_ADJUST_DESCRIPTOR, "__builtin_adjust_descriptor")
DEF_BUILTIN_STUB (BUILT_IN_NONLOCAL_GOTO, "__builtin_nonlocal_goto")
-DEF_BUILTIN_STUB (BUILT_IN_NESTED_PTR_CREATED, "__builtin_nested_func_ptr_created")
-DEF_BUILTIN_STUB (BUILT_IN_NESTED_PTR_DELETED, "__builtin_nested_func_ptr_deleted")
+DEF_EXT_LIB_BUILTIN (BUILT_IN_GCC_NESTED_PTR_CREATED, "__gcc_nested_func_ptr_created", BT_FN_VOID_PTR_PTR_PTR, ATTR_NOTHROW_LIST)
+DEF_EXT_LIB_BUILTIN (BUILT_IN_GCC_NESTED_PTR_DELETED, "__gcc_nested_func_ptr_deleted", BT_FN_VOID, ATTR_NOTHROW_LIST)
/* Implementing __builtin_setjmp. */
DEF_BUILTIN_STUB (BUILT_IN_SETJMP_SETUP, "__builtin_setjmp_setup")
By default, trampolines are generated on stack. However, certain platforms
(such as the Apple M1) do not permit an executable stack. Compiling with
@option{-ftrampoline-impl=heap} generate calls to
-@code{__builtin_nested_func_ptr_created} and
-@code{__builtin_nested_func_ptr_deleted} in order to allocate and
+@code{__gcc_nested_func_ptr_created} and
+@code{__gcc_nested_func_ptr_deleted} in order to allocate and
deallocate trampoline space on the executable heap. These functions are
implemented in libgcc, and will only be provided on specific targets:
x86_64 Darwin, x86_64 and aarch64 Linux. @emph{PLEASE NOTE}: Heap
root->frame_decl, field, NULL_TREE);
arg3 = build_addr (x);
- x = builtin_decl_implicit (BUILT_IN_NESTED_PTR_CREATED);
+ x = builtin_decl_explicit (BUILT_IN_GCC_NESTED_PTR_CREATED);
stmt = gimple_build_call (x, 3, arg1, arg2, arg3);
gimple_seq_add_stmt (&stmt_list, stmt);
/* This call to delete the nested function trampoline is added to
the cleanup list, and called when we exit the current scope. */
- x = builtin_decl_implicit (BUILT_IN_NESTED_PTR_DELETED);
+ x = builtin_decl_explicit (BUILT_IN_GCC_NESTED_PTR_DELETED);
stmt = gimple_build_call (x, 0);
gimple_seq_add_stmt (&cleanup_list, stmt);
}
tree ptr_ptr_type_node = build_pointer_type (ptr_type_node);
- ftype = build_function_type_list (void_type_node,
- ptr_type_node, // void *chain
- ptr_type_node, // void *func
- ptr_ptr_type_node, // void **dst
- NULL_TREE);
- local_define_builtin ("__builtin_nested_func_ptr_created", ftype,
- BUILT_IN_NESTED_PTR_CREATED,
- "__builtin_nested_func_ptr_created", ECF_NOTHROW);
+ if (!builtin_decl_explicit_p (BUILT_IN_GCC_NESTED_PTR_CREATED))
+ {
+ ftype = build_function_type_list (void_type_node,
+ ptr_type_node, // void *chain
+ ptr_type_node, // void *func
+ ptr_ptr_type_node, // void **dst
+ NULL_TREE);
+ local_define_builtin ("__builtin___gcc_nested_func_ptr_created", ftype,
+ BUILT_IN_GCC_NESTED_PTR_CREATED,
+ "__gcc_nested_func_ptr_created", ECF_NOTHROW);
+ }
- ftype = build_function_type_list (void_type_node,
- NULL_TREE);
- local_define_builtin ("__builtin_nested_func_ptr_deleted", ftype,
- BUILT_IN_NESTED_PTR_DELETED,
- "__builtin_nested_func_ptr_deleted", ECF_NOTHROW);
+ if (!builtin_decl_explicit_p (BUILT_IN_GCC_NESTED_PTR_DELETED))
+ {
+ ftype = build_function_type_list (void_type_node, NULL_TREE);
+ local_define_builtin ("__builtin___gcc_nested_func_ptr_deleted", ftype,
+ BUILT_IN_GCC_NESTED_PTR_DELETED,
+ "__gcc_nested_func_ptr_deleted", ECF_NOTHROW);
+ }
ftype = build_function_type_list (void_type_node,
ptr_type_node, ptr_type_node, NULL_TREE);
struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent);
void *allocate_trampoline_page (void);
-void __builtin_nested_func_ptr_created (void *chain, void *func, void **dst);
-void __builtin_nested_func_ptr_deleted (void);
+void __gcc_nested_func_ptr_created (void *chain, void *func, void **dst);
+void __gcc_nested_func_ptr_deleted (void);
#if defined(__gnu_linux__)
static const uint32_t aarch64_trampoline_insns[] = {
}
void
-__builtin_nested_func_ptr_created (void *chain, void *func, void **dst)
+__gcc_nested_func_ptr_created (void *chain, void *func, void **dst)
{
if (tramp_ctrl_curr == NULL)
{
}
void
-__builtin_nested_func_ptr_deleted (void)
+__gcc_nested_func_ptr_deleted (void)
{
if (tramp_ctrl_curr == NULL)
abort ();
struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent);
void *allocate_trampoline_page (void);
-void __builtin_nested_func_ptr_created (void *chain, void *func, void **dst);
-void __builtin_nested_func_ptr_deleted (void);
+void __gcc_nested_func_ptr_created (void *chain, void *func, void **dst);
+void __gcc_nested_func_ptr_deleted (void);
static const uint8_t trampoline_insns[] = {
/* movabs $<chain>,%r11 */
}
void
-__builtin_nested_func_ptr_created (void *chain, void *func, void **dst)
+__gcc_nested_func_ptr_created (void *chain, void *func, void **dst)
{
if (tramp_ctrl_curr == NULL)
{
}
void
-__builtin_nested_func_ptr_deleted (void)
+__gcc_nested_func_ptr_deleted (void)
{
if (tramp_ctrl_curr == NULL)
abort ();
GCC_7.0.0 {
__PFX__divmoddi4
__PFX__divmodti4
-
- __builtin_nested_func_ptr_created
- __builtin_nested_func_ptr_deleted
}
%inherit GCC_14.0.0 GCC_7.0.0
__PFX__strub_enter
__PFX__strub_update
__PFX__strub_leave
+ __gcc_nested_func_ptr_created
+ __gcc_nested_func_ptr_deleted
}
#pragma GCC visibility push(default)
#endif
-extern void __builtin_nested_func_ptr_created (void *, void *, void **);
-extern void __builtin_nested_func_ptr_deleted (void);
+extern void __gcc_nested_func_ptr_created (void *, void *, void **);
+extern void __gcc_nested_func_ptr_deleted (void);
extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t);
extern void __clear_cache (void *, void *);