How to use .pushsection?
Maciej W. Rozycki
macro@linux-mips.org
Thu Oct 11 16:26:00 GMT 2007
On Thu, 11 Oct 2007, Lee Duhem wrote:
> The document says
>
> `.pushsection NAME , SUBSECTION'
>
> This directive pushes the current section (and subsection) onto the
> top of the section stack, and then replaces the current section and
> subsection with `name' and `subsection'.
>
> but when assembling the following sentences:
>
> .section sec1
>
> .pushsection sec2,1
>
> gas complaining
>
> t.s: Assembler messages:
> t.s:3: Error: character following name is not '#'
>
> What's this error mean? Did I misunderstood some thing?
The syntax is unimplemented -- you can only select a section, optionally
followed by a flags, like with the .section directive. The reason code
disagrees with documentation is probably them having been added at
different times, about a year apart. A possible workaround is as follows:
.section sec1
.pushsection sec2
.pushsection sec2
.subsection 1
.previous
.popsection
Ugly, but it should work. I think it would be a good idea to make
.pushsection match the documentation with respect to subsections though as
this is useful semantics.
Maciej
More information about the Binutils
mailing list