https://sourceware.org/bugzilla/show_bug.cgi?id=33336

            Bug ID: 33336
           Summary: gas: Clarify whitespace between a label’s symbol and
                    its colon
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: i at maskray dot me
  Target Milestone: ---

https://sourceware.org/binutils/docs/as/Statements.html specifies

> A label is a symbol immediately followed by a colon (:). Whitespace before a 
> label or after a colon is permitted, **but you may not have whitespace 
> between a label’s symbol and its colon**. See Labels.

According to this description, the following assembly should not be permitted:

f :op:nop

However, this is identical to `f: op: nop` and will be assembled as two labels
with a nop instruction (in at least x86, aarch64, powerpc64; I believe this
likely applies to most targets). LLVM integrated assembler interprets this the
same way.

If we are not going to change the implementation regarding labels, I think we
should clarify the documentation.

---

Context:
AArch32 and AArch64 adopt this colon-framed prefix notation, avoiding the
confusion that parentheses might introduce.

// AArch32
movw    r0, :lower16:x

// AArch64
add     x8, x8, :lo12:sym

Applying this syntax to the first operand, however, could create parsing
ambiguity. In
https://maskray.me/blog/2025-03-16-relocation-generation-in-assemblers ,
I am suggesting that data directives switch to %specifier(expr).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to