public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* 'dollar local labels' in GAS do not appear to be implemented
@ 2015-05-04  8:09 Somchai Smythe
  2015-05-04  9:48 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Somchai Smythe @ 2015-05-04  8:09 UTC (permalink / raw)
  To: binutils

Hello,

I cannot get 'dolloar local labels' that are described in the GNU
assembly manual to work.  Here is what I tried to assemble:

        .file 1 "trouble.s"
        .att_syntax
        .att_mnemonic
        .arch core2,nojumps
        .code64

        .section .text,"ax",@progbits
        .globl  _start
        .type   main, @function
        .align 16, 0x90
_start:
        jmp     55$f
55$:
        movabsq $0, %rdi # return code indicates success
        movabsq $__NR_exit, %rax
        syscall
        .section .note.GNU-stack,"",@progbits

Here is what it says:

as trouble.s -o trouble.o
trouble.s: Assembler messages:
trouble.s:12: Error: junk `$f' after expression
trouble.s:13: Error: junk at end of line, first unrecognized character is `5'

as --version
GNU assembler (GNU Binutils for Ubuntu) 2.25
Copyright (C) 2014 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-linux-gnu'.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 'dollar local labels' in GAS do not appear to be implemented
  2015-05-04  8:09 'dollar local labels' in GAS do not appear to be implemented Somchai Smythe
@ 2015-05-04  9:48 ` Andreas Schwab
  2015-05-05  2:46   ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2015-05-04  9:48 UTC (permalink / raw)
  To: Somchai Smythe; +Cc: binutils

Somchai Smythe <buraphalinuxserver@gmail.com> writes:

> I cannot get 'dolloar local labels' that are described in the GNU
> assembly manual to work.

Support for dollar labels is target dependent.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 'dollar local labels' in GAS do not appear to be implemented
  2015-05-04  9:48 ` Andreas Schwab
@ 2015-05-05  2:46   ` Mike Frysinger
  2015-05-06 12:12     ` Nicholas Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2015-05-05  2:46 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Somchai Smythe, binutils

[-- Attachment #1: Type: text/plain, Size: 766 bytes --]

On 04 May 2015 11:48, Andreas Schwab wrote:
> Somchai Smythe <buraphalinuxserver@gmail.com> writes:
> > I cannot get 'dolloar local labels' that are described in the GNU
> > assembly manual to work.
> 
> Support for dollar labels is target dependent.

https://sourceware.org/binutils/docs/as/Symbol-Names.html

the intro section does note that it's machine dependent, but the section that 
discusses them in detail does not.  if you're scanning headers, you could easily 
miss that caveat.  guess we propagate that note down.

Somchai: you can just use local labels instead -- those should work on every 
target.  see the aforementioned page under "Local Labels".  same goes for the .L 
labels if you want names vs simple "1f" and "1b" names.
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 'dollar local labels' in GAS do not appear to be implemented
  2015-05-05  2:46   ` Mike Frysinger
@ 2015-05-06 12:12     ` Nicholas Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Clifton @ 2015-05-06 12:12 UTC (permalink / raw)
  To: Andreas Schwab, Somchai Smythe, binutils

[-- Attachment #1: Type: text/plain, Size: 686 bytes --]

Hi Guys.

 >> Support for dollar labels is target dependent.
>
> https://sourceware.org/binutils/docs/as/Symbol-Names.html
>
> the intro section does note that it's machine dependent,

> guess we propagate that note down.

I am checking in the attached patch to update the documentation as follows:

   5.3 Symbol Names
   ================

[...]

   Symbol names do not start with a digit.  An exception to this rule
   is made for Local Labels.  See below.


[...]


   Dollar Local Labels
   -------------------

   On some targets 'as' also supports an even more local form of local
   labels called dollar labels.  These labels go out of scope (i.e., they

[...]


Cheers
   Nick


[-- Attachment #2: as.texinfo.patch --]
[-- Type: text/x-patch, Size: 3404 bytes --]

diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
index aac488e..b5e405a 100644
--- a/gas/doc/as.texinfo
+++ b/gas/doc/as.texinfo
@@ -3654,6 +3654,9 @@ on the H8/300), and underscores.
 Case of letters is significant: @code{foo} is a different symbol name
 than @code{Foo}.
 
+Symbol names do not start with a digit.  An exception to this rule is made for
+Local Labels.  See below.
+
 Multibyte characters are supported.  To generate a symbol name containing
 multibyte characters enclose it within double quotes and use escape codes. cf
 @xref{Strings}.  Generating a multibyte symbol name from a label is not
@@ -3685,15 +3688,15 @@ to retain the local symbols in the object files.
 @cindex local labels
 @cindex temporary symbol names
 @cindex symbol names, temporary
-Local labels help compilers and programmers use names temporarily.
-They create symbols which are guaranteed to be unique over the entire scope of
-the input source code and which can be referred to by a simple notation.
-To define a local label, write a label of the form @samp{@b{N}:} (where @b{N}
-represents any positive integer).  To refer to the most recent previous
-definition of that label write @samp{@b{N}b}, using the same number as when
-you defined the label.  To refer to the next definition of a local label, write
-@samp{@b{N}f}---the @samp{b} stands for ``backwards'' and the @samp{f} stands
-for ``forwards''.
+Local labels are different from local symbols.  Local labels help compilers and
+programmers use names temporarily.  They create symbols which are guaranteed to
+be unique over the entire scope of the input source code and which can be
+referred to by a simple notation.  To define a local label, write a label of
+the form @samp{@b{N}:} (where @b{N} represents any positive integer).  To refer
+to the most recent previous definition of that label write @samp{@b{N}b}, using
+the same number as when you defined the label.  To refer to the next definition
+of a local label, write @samp{@b{N}f}---the @samp{b} stands for ``backwards''
+and the @samp{f} stands for ``forwards''.
 
 There is no restriction on how you can use these labels, and you can reuse them
 too.  So that it is possible to repeatedly define the same local label (using
@@ -3758,12 +3761,12 @@ the 44th @code{3:} may be named @code{.L3@kbd{C-B}44}.
 @subheading Dollar Local Labels
 @cindex dollar local symbols
 
-@code{@value{AS}} also supports an even more local form of local labels called
-dollar labels.  These labels go out of scope (i.e., they become undefined) as
-soon as a non-local label is defined.  Thus they remain valid for only a small
-region of the input source code.  Normal local labels, by contrast, remain in
-scope for the entire file, or until they are redefined by another occurrence of
-the same local label.
+On some targets @code{@value{AS}} also supports an even more local form of
+local labels called dollar labels.  These labels go out of scope (i.e., they
+become undefined) as soon as a non-local label is defined.  Thus they remain
+valid for only a small region of the input source code.  Normal local labels,
+by contrast, remain in scope for the entire file, or until they are redefined
+by another occurrence of the same local label.
 
 Dollar labels are defined in exactly the same way as ordinary local labels,
 except that they have a dollar sign suffix to their numeric value, e.g.,

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-06 12:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-04  8:09 'dollar local labels' in GAS do not appear to be implemented Somchai Smythe
2015-05-04  9:48 ` Andreas Schwab
2015-05-05  2:46   ` Mike Frysinger
2015-05-06 12:12     ` Nicholas Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).