Bug 9915 - LOCAL_LABELS_DOLLAR doesn't work on Freebsd/x86
Summary: LOCAL_LABELS_DOLLAR doesn't work on Freebsd/x86
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.20
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-01 20:35 UTC by H.J. Lu
Modified: 2009-03-09 18:34 UTC (History)
2 users (show)

See Also:
Host:
Target: i386-pc-freebsd
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 2009-03-01 20:35:39 UTC
te-freebsd.h has

#define LOCAL_LABELS_DOLLAR 1

But LOCAL_LABELS_DOLLAR never really works completely for x86 assembler.
When assembler sees $foo, it can't tell if $foo is a label or the value
of symbol foo. I do have a hack for x86 assembler, which assumes $_XXX
is a local label if LOCAL_LABELS_DOLLAR is defined. But it won't work
when _XXX is a real label.

bash-3.2$ cat /tmp/f.s
$foo:
       movl $foo(%eax), %eax
bash-3.2$ ./as-new -o f.o /tmp/f.s
/tmp/f.s: Assembler messages:
/tmp/f.s:2: Error: junk `(%eax)' after expression
bash-3.2$ 

I think LOCAL_LABELS_DOLLAR should be undefined for all x86 targets.
Comment 1 H.J. Lu 2009-03-01 20:42:18 UTC
When '$' is used as the immediate prefix, LOCAL_LABELS_DOLLAR should
be 0.
Comment 2 H.J. Lu 2009-03-01 21:51:48 UTC
A patch is posted at

http://sourceware.org/ml/binutils/2009-03/msg00008.html
Comment 3 Sourceware Commits 2009-03-09 18:33:58 UTC
Subject: Bug 9915

CVSROOT:	/cvs/src
Module name:	src
Changes by:	hjl@sourceware.org	2009-03-09 18:33:42

Modified files:
	gas            : ChangeLog 
	gas/config     : tc-i386.h 

Log message:
	2009-03-09  H.J. Lu  <hongjiu.lu@intel.com>
	
	PR gas/9915
	* config/tc-i386.h (LOCAL_LABELS_DOLLAR): New.  Defined as 0.
	(LOCAL_LABELS_FB): Undefine befoe define.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.3760&r2=1.3761
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/config/tc-i386.h.diff?cvsroot=src&r1=1.101&r2=1.102

Comment 4 H.J. Lu 2009-03-09 18:34:14 UTC
Fixed.