Bug 876 - .space with non-absolute value
Summary: .space with non-absolute value
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.15
: P2 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on: 10903
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-26 19:57 UTC by Hollis Blanchard
Modified: 2019-11-22 04:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Proposed patch (978 bytes, patch)
2005-05-05 17:01 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hollis Blanchard 2005-04-26 19:57:39 UTC
$ cat<<EOF>testcase.S
label1:
        .space FOO
label2:
EOF
$ gcc -c testcase.S
asmtest.S: Assembler messages:
asmtest.S:3: Error: .space specifies non-absolute value

That error message is expected. Now try this:
$ cat<<EOF>testcase.S
label1:
        .space FOO*4
label2:
EOF
$ gcc -c testcase.S
$ echo $?
0
$ nm testcase.o
                 U FOO
0000000000000000 t label1
0000000000000000 t label2

I should get the same build error as before. This behavior occurs with * and <<,
but not + (i.e. FOO+4 fails to build, but FOO<<4 succeeds).

I've observed this with:
        binutils  gcc
x86-64  2.15      3.3.5
ppc64   2.15      3.4.2
Comment 1 Nick Clifton 2005-05-05 17:00:49 UTC
Hi,

  This appears to be a bug in the symbol value evaluation code in gas.  It has
special case code for + and - based expressions, but for others it just ignores
any errors unless the value is being finalized.

  Please could you try the attached patch and let me know how you get on with it ?

Cheers
  Nick
Comment 2 Nick Clifton 2005-05-05 17:01:42 UTC
Created attachment 477 [details]
Proposed patch
Comment 3 Hollis Blanchard 2005-05-16 18:28:08 UTC
Works for me, tested with binutils 2.16. Thanks!
Comment 4 Nick Clifton 2005-05-17 16:01:37 UTC
Hi Hollis,

  Great.  I have now checked this patch in along with this ChangeLog entry.

Cheers
  Nick

gas/ChangeLog
2005-05-17  Nick Clifton  <nickc@redhat.com>

	PR 876
	* symbols.c (resolve_symbol_value): Do not move symbols whose
	value expression has not been resolved or finalized into the
	absolute section as this will confuse other parts of the assembler
	into thinking that their value is zero.
Comment 5 H.J. Lu 2009-11-04 18:21:29 UTC
The fix caused PR 10903 and we don't have a testcase for this PR.
Comment 6 cvs-commit@gcc.gnu.org 2009-11-04 18:52:19 UTC
Subject: Bug 876

CVSROOT:	/cvs/src
Module name:	src
Changes by:	hjl@sourceware.org	2009-11-04 18:52:04

Modified files:
	gas/testsuite  : ChangeLog 
	gas/testsuite/gas/i386: i386.exp 
Added files:
	gas/testsuite/gas/i386: space1.l space1.s 

Log message:
	2009-11-04  H.J. Lu  <hongjiu.lu@intel.com>
	
	PR gas/876
	* gas/i386/i386.exp: Run space1.
	
	* gas/i386/space1.l: New.
	* gas/i386/space1.s: Likewise.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1578&r2=1.1579
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/space1.l.diff?cvsroot=src&r1=NONE&r2=1.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/space1.s.diff?cvsroot=src&r1=NONE&r2=1.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/i386.exp.diff?cvsroot=src&r1=1.122&r2=1.123

Comment 7 Alan Modra 2019-11-22 04:39:46 UTC
Reopened in error