No, there is code in use_thunk that sets the section of the thunk to match
the section of the function if the function is DECL_ONE_ONLY:
if (TARGET_USE_LOCAL_THUNK_ALIAS_P (function)
&& targetm.have_named_sections)
{
resolve_unique_section (function, 0, flag_function_sections);
if (DECL_SECTION_NAME (function) != NULL && DECL_ONE_ONLY (function))
{
resolve_unique_section (thunk_fndecl, 0, flag_function_sections);
/* Output the thunk into the same section as function. */
DECL_SECTION_NAME (thunk_fndecl) = DECL_SECTION_NAME (function);
}
}
AFAICS after the first resolve_unique_section call
DECL_SECTION_NAME (function) should always be set if the function is
DECL_ONE_ONLY and the port fully supports named sections.