On Tue, Jun 21, 2016 at 08:55:15PM -0600, Jeff Law wrote:
> user_defined_section_attribute was introduced as part of the hot/cold
> partitioning changes.
> 
> https://gcc.gnu.org/ml/gcc-patches/2004-07/msg01545.html
> 
> 
> What's supposed to happen is hot/cold partitioning is supposed to be turned
> off for the function which has the a user defined section attribute.

The flag has been added before we had -funit-at-a-time, and IMNSHO it
couldn't work properly even when it has been introduced, because if you had
void foo (void) __attribute__((section ("...")));
void bar (void)
{
...
}
void foo (void)
{
...
}
then it would mistakenly apply to bar rather than foo.
So, either we can reconstruct whether the current function decl has user
section attribute, then perhaps during expansion we should set the flag
to that or use such a test directly in the gate (e.g. would lookup_attribute
("section", DECL_ATTRIBUTES (current_function_decl)) DTRT?) and drop the
flag, or we need some way to preserve that information per function.

        Jakub

Reply via email to