[llvm-commits] [PATCH] [MC] .pushsection / .popsection support

Joerg Sonnenberger joerg at britannica.bec.de
Wed Feb 9 13:40:37 PST 2011


On Wed, Feb 09, 2011 at 01:29:23PM -0800, Nick Lewycky wrote:
> On 9 February 2011 12:28, Joerg Sonnenberger <joerg at britannica.bec.de>wrote:
> 
> > Hi all,
> > attached patch is the initial support for .pushsection / .popsection.
> > To do this properly requires a change in the MCStreamer API. One
> > approach is attached. I think a better idea would be to split the
> > current SwitchSection() into two parts: the common code to manage
> > CurSection / PrevSection and a virtual function ChangeSection that gets
> > called if the new CurSection differs from the old one. There are a bunch
> > of bugs with the handling of changing to the current section again.
> >
> 
> Why does this need a second SwitchSection method and why does it need to
> take the previous as an argument? Why not just take the current one, then
> switch to the new one?

Because .popstack changes both the current and last section. More
importantly, it can set the previous section to NULL, so it can't just
be emulated with two calls to SwitchSection.

Splitting the current SwitchSection would be cleaner and fix some issues
as I mentioned.

> Also, did you check that a .s which consists entirely of ".previous" gives a
> nice error? GAS says:
> x.s:1: Warning: .previous without corresponding .section; ignored

I haven't touched .previous and don't plan to do it for this patch.
It is an unrelated issue.

Joerg



More information about the llvm-commits mailing list