@@ -11086,20 +11086,26 @@ if this routine has a body (dump nothing if it has no body).
1108611086 (a_storage_class )sc_unspecified ,
1108711087 "dump_routine_decl: rout without defn in comdat" );
1108811088 if (gcc_or_clang_is_generated_code_target
11089- #if GNU_EXTENSIONS_ALLOWED
11090- && !rout -> always_inline /* gcc gives an error on weak functions with
11091- the always_inline attribute (because they
11092- can change at link time). */
11093- #if !LOWER_IFUNC
11089+ #if GNU_EXTENSIONS_ALLOWED && !LOWER_IFUNC
1109411090 && !rout -> is_ifunc /* gcc doesn't allow ifunc to be weak, so
1109511091 suppress the weak attribute (though this
1109611092 may result in multiple-definition errors
1109711093 in some cases). */
11098- #endif /* !LOWER_IFUNC */
11099- #endif /* GNU_EXTENSIONS_ALLOWED */
11094+ #endif /* GNU_EXTENSIONS_ALLOWED && !LOWER_IFUNC */
1110011095 ) {
1110111096 /* GCC does not support COMDAT, but it does support weak, which
1110211097 provides a sufficient approximation. */
11098+ #if GNU_EXTENSIONS_ALLOWED
11099+ if (rout -> always_inline && gcc_is_generated_code_target ) {
11100+ /* gcc gives an error on calls to a weak function with the
11101+ always_inline attribute (because the definition could be
11102+ replaced at link time). Without the weak attribute each
11103+ translation unit that defines the routine contains a conflicting
11104+ external definition of it, so suppress the always_inline
11105+ attribute instead (Clang accepts both). */
11106+ rout -> always_inline = FALSE;
11107+ } /* if */
11108+ #endif /* GNU_EXTENSIONS_ALLOWED */
1110311109 write_tok_str (" __attribute__((__weak__))" );
1110411110 is_marked_weak = TRUE;
1110511111 } /* if */
0 commit comments