On Thu, 2 May 2013, Richard Sandiford wrote:
> Thanks for the prod. I had to go back and work out why I thought this
> change was right in the first place (my excuse for putting it off so long).
> Here's what I committed.
Thanks to you both for working on this -- I've noticed the problem
recently too and had a similar proposal pending. FWIW here's the comment
I prepared for that change:
/* Handle .stab directives. We need this in order to mark a label
as being a MIPS16 or microMIPS text label correctly. In the STABS
debugging mode at the beginning of a function the compiler will emit
a label, followed by a .stab directive, and only then actual code.
The .stab directive however temporarily switches sections and before
that calls md_flush_pending_output losing compressed allocation from
the label. As a result the function is called in the wrong execution
mode and does not work.
FIXME: Ideally we should be able to preserve the pending label state
across section switches and either commit label marking when a
section and its held state is discarded from the section stack with
the second section switch or restore it along its section with
.previous or .popsection. That would require a serious
infrastructure redesign, starting with a replacement of the
md_flush_pending_output hook with a more complex arrangement. */
because I think all this is really papering over the problem of forgetting
the label state across a section switch. This happens implicitly for
these .stab directives (that are also seldom used these days), but I
reckon I saw a case where it mattered for explicit section switches and
had to be worked around somehow. It would be good to have some thought as
to how to do this properly some day.
Maciej