@@ -1120,22 +1120,24 @@ get_symbol_decl (Declaration *decl)
11201120 d_keep (newfntype);
11211121 }
11221122
1123- /* Miscellaneous function flags. */
1124- if (fd->isMember2 () || fd->isFuncLiteralDeclaration ())
1123+ /* In [pragma/inline], The attribute pragma(inline) affects whether a
1124+ function should be inlined or not. */
1125+ if (fd->inlining == PINLINEnever)
1126+ DECL_UNINLINABLE (decl->csym ) = 1 ;
1127+ else if (fd->inlining == PINLINEalways)
1128+ {
1129+ DECL_DECLARED_INLINE_P (decl->csym ) = 1 ;
1130+ DECL_DISREGARD_INLINE_LIMITS (decl->csym ) = 1 ;
1131+ DECL_COMDAT (decl->csym ) = 1 ;
1132+ }
1133+ else if (fd->isMember2 () || fd->isFuncLiteralDeclaration ())
11251134 {
11261135 /* See grokmethod in cp/decl.c. Maybe we shouldn't be setting inline
11271136 flags without reason or proper handling. */
11281137 DECL_DECLARED_INLINE_P (decl->csym ) = 1 ;
11291138 DECL_NO_INLINE_WARNING_P (decl->csym ) = 1 ;
11301139 }
11311140
1132- /* Function was declared 'naked'. */
1133- if (fd->naked )
1134- {
1135- DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (decl->csym ) = 1 ;
1136- DECL_UNINLINABLE (decl->csym ) = 1 ;
1137- }
1138-
11391141 /* Vector array operations are always compiler generated. */
11401142 if (fd->isArrayOp )
11411143 {
@@ -1219,12 +1221,6 @@ get_symbol_decl (Declaration *decl)
12191221 DECL_EXTERNAL (decl->csym ) = 1 ;
12201222
12211223 d_comdat_linkage (decl->csym );
1222-
1223- /* Normally the backend only emits COMDAT things when they are needed.
1224- If this decl is meant to be externally visible, then make sure that
1225- to mark it so that it is indeed needed. */
1226- if (TREE_PUBLIC (decl->csym ))
1227- mark_needed (decl->csym );
12281224 }
12291225 else
12301226 {
@@ -1234,6 +1230,20 @@ get_symbol_decl (Declaration *decl)
12341230 else
12351231 DECL_EXTERNAL (decl->csym ) = 1 ;
12361232 }
1233+
1234+ /* Normally the backend only emits COMDAT things when they are needed.
1235+ If this decl is meant to be externally visible, then make sure that
1236+ to mark it so that it is indeed needed. */
1237+ if (TREE_PUBLIC (decl->csym ) && (fd != NULL || ti != NULL ))
1238+ {
1239+ /* Don't keep functions declared pragma(inline, true) unless
1240+ the user wants us to keep all inline functions. */
1241+ if (fd && fd->inlining == PINLINEalways
1242+ && !flag_keep_inline_functions)
1243+ DECL_COMDAT (decl->csym ) = 1 ;
1244+ else if (ti)
1245+ mark_needed (decl->csym );
1246+ }
12371247 }
12381248
12391249 /* Symbol is going in thread local storage. */
0 commit comments