Bug 5221 - .pushsection is broken
Summary: .pushsection is broken
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: unspecified
: P1 critical
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-26 06:53 UTC by H.J. Lu
Modified: 2007-10-29 01:10 UTC (History)
2 users (show)

See Also:
Host:
Target: x86_64-unknown-linux-gnu
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2007-10-26 06:53:04 UTC
When building Linux kernel 2.6.23, I got

pageattr.s: Assembler messages:
pageattr.s:219: Error: bad expression
pageattr.s:219: Error: junk at end of line, first unrecognized character is `a'
pageattr.s:239: Error: bad expression
pageattr.s:239: Error: junk at end of line, first unrecognized character is `a'
pageattr.s:502: Error: bad expression
pageattr.s:502: Error: junk at end of line, first unrecognized character is `a'
pageattr.s:519: Error: bad expression
pageattr.s:519: Error: junk at end of line, first unrecognized character is `a'
pageattr.s:540: Error: bad expression
pageattr.s:540: Error: junk at end of line, first unrecognized character is `a'
pageattr.s:594: Error: bad expression
pageattr.s:594: Error: junk at end of line, first unrecognized character is `a'
pageattr.s:619: Error: bad expression
pageattr.s:619: Error: junk at end of line, first unrecognized character is `a'
pageattr.s:641: Error: bad expression
pageattr.s:641: Error: junk at end of line, first unrecognized character is `a'

It may be introduced by

http://sourceware.org/ml/binutils/2007-10/msg00178.html
Comment 1 H.J. Lu 2007-10-26 06:56:25 UTC
bash-3.2$ cat x.s
        .text
        movl    (%rbx), %eax
        1:      ud2
.pushsection __bug_table,"a"
2:      .quad 1b, .LC0
        .word 136, 0
        .org 2b+24
.popsection
.L21:
        jmp     .L21
bash-3.2$ gcc -c x.s
x.s: Assembler messages:
x.s:4: Error: bad expression
x.s:4: Error: junk at end of line, first unrecognized character is `a'
bash-3.2$ 
Comment 2 Nick Clifton 2007-10-26 06:59:33 UTC
Hi H.J.

  The test case (and presumably the pageattr.s source file) are broken.  The
.pushsection pseudo-op takes a subsection number as its optional second
argument.  Using a string is incorrect.  Hence I do not think that this is a
real bug.

Cheers
  Nick
Comment 3 H.J. Lu 2007-10-26 13:01:22 UTC
For ELF, you can specify flags, type and others with

 .section NAME [, "FLAGS"[, @TYPE[,FLAG_SPECIFIC_ARGUMENTS]]]

.subsection also should support them. The previous assembler did. The
previous manual had

----
7.81 `.pushsection NAME , SUBSECTION'
=====================================

This is one of the ELF section stack manipulation directives.  The
others are `.section' (*note Section::), `.subsection' (*note
SubSection::), `.popsection' (*note PopSection::), and `.previous'
(*note Previous::).

   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'.
----

I believe it should be

.pushsection NAME [, SUBSECTION[, "FLAGS"[, @TYPE[,FLAG_SPECIFIC_ARGUMENTS]]]]


Comment 4 H.J. Lu 2007-10-26 17:28:17 UTC
A patch is posted at

http://sourceware.org/ml/binutils/2007-10/msg00364.html
Comment 5 H.J. Lu 2007-10-29 01:10:14 UTC
Fixed.