https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120301
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org Version|unknown |16.0 --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- I guess __builtin_section_p ("string") (rather a pattern than a fixed string I guess) is least intrusive but one issue is that it can give different answers after/before inlining or IPA optimizations. That means evaluation would have to be delayed until after inlining but that means the answer could be different for different optimization levels? How should inline int foo () { return __builtin_section_p ("init"); } int foo (); int __attribute__((section ("init"))) bar () { return foo (); } behave? There's a text definition of foo() (C99 inline semantics) that is in .text, thus it returns false. But when inlined into bar() and the builtin is evaluated late it would return true. I know the kernel doesn't use C99 inline and exclusively GNU extern inline (no out-of-line copies of inline functions), but there's still automatic inlining. So, can you come up with a specification of __builtin_section_p?