@@ -515,6 +515,8 @@ const char* fn_attribute_to_string(gcc_jit_fn_attribute attr)
515
515
{
516
516
switch (attr)
517
517
{
518
+ case GCC_JIT_FN_ATTRIBUTE_ALIAS:
519
+ return " alias" ;
518
520
case GCC_JIT_FN_ATTRIBUTE_ALWAYS_INLINE:
519
521
return " always_inline" ;
520
522
case GCC_JIT_FN_ATTRIBUTE_INLINE:
@@ -535,6 +537,8 @@ const char* fn_attribute_to_string(gcc_jit_fn_attribute attr)
535
537
return " pure" ;
536
538
case GCC_JIT_FN_ATTRIBUTE_CONST:
537
539
return " const" ;
540
+ case GCC_JIT_FN_ATTRIBUTE_WEAK:
541
+ return " weak" ;
538
542
}
539
543
return NULL ;
540
544
}
@@ -682,6 +686,9 @@ new_function (location *loc,
682
686
/* See handle_const_attribute in gcc/c-family/c-attribs.cc. */
683
687
else if (attr == GCC_JIT_FN_ATTRIBUTE_CONST)
684
688
TREE_READONLY (fndecl) = 1 ;
689
+ /* See handle_weak_attribute in gcc/c-family/c-attribs.cc. */
690
+ else if (attr == GCC_JIT_FN_ATTRIBUTE_WEAK)
691
+ declare_weak (fndecl);
685
692
686
693
const char * attribute = fn_attribute_to_string (attr);
687
694
if (attribute)
@@ -706,6 +713,15 @@ new_function (location *loc,
706
713
if (!ident || !targetm.target_option .valid_attribute_p (fndecl, ident, attribute_value, 0 ))
707
714
continue ;
708
715
716
+ /* See handle_alias_ifunc_attribute in gcc/c-family/c-attribs.cc. */
717
+ if (name == GCC_JIT_FN_ATTRIBUTE_ALIAS)
718
+ {
719
+ tree id = get_identifier (value.c_str ());
720
+ /* This counts as a use of the object pointed to. */
721
+ TREE_USED (id) = 1 ;
722
+ DECL_INITIAL (fndecl) = error_mark_node;
723
+ }
724
+
709
725
if (ident)
710
726
DECL_ATTRIBUTES (fndecl) =
711
727
tree_cons (ident, attribute_value, DECL_ATTRIBUTES (fndecl));
@@ -2282,6 +2298,9 @@ postprocess ()
2282
2298
2283
2299
current_function_decl = NULL ;
2284
2300
}
2301
+ else
2302
+ /* Add to cgraph to output aliases: */
2303
+ rest_of_decl_compilation (m_inner_fndecl, true , 0 );
2285
2304
}
2286
2305
2287
2306
/* Don't leak vec's internal buffer (in non-GC heap) when we are
0 commit comments