[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in gas, with expressions in macros
From: |
Nick Clifton |
Subject: |
Re: Bug in gas, with expressions in macros |
Date: |
22 May 2002 16:35:14 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1 |
Hi Brian,
> Does anyone know if this situation has been pursued at all? I still
> get the error in larger files despite having listings turned off. It
> appears that X_op ends up being O_subtract instead of O_constant
> when you do subtraction of two variables in the same memory section
> (or subtraction of two constants inside a macro that may or may not
> be in the same memory section). I'm interested in
> providing/finding/assisting with a fix for this problem. Please let
> me know if you have anymore information. Thanks,
The problem, at least with listings enabled, is that the listing code
creates a new frag between each line. This effectively seperates the
declaration of the label .__start_of_init__ in your example the
reference to it in the invocation of the VEC macro on the following
line:
.macro VEC name
.if ( . - .__start_of_init__ )
.string "Hello"
.endif
.endm
.__start_of_init__:
VEC _vector_1
Since (at the time when the .if is being evaluated) frags can be
resized, it is impossible to calculate the value of ". -
.__start_of_init__" and hence the assembler complains about a
non-constant expression.
The fix, it seems to me, is to stop the listing code from creating a
new frag. For example the attached patch will make your test code
assemble even when -an is specified. I have not tested this patch
extensively however, and I suspect that it will interfere with proper
listing generation. You might find it to be a starting point however.
Cheers
Nick
Index: gas/listing.c
===================================================================
RCS file: /cvs/src/src/gas/listing.c,v
retrieving revision 1.19
diff -c -3 -p -w -r1.19 listing.c
*** gas/listing.c 18 May 2002 12:53:30 -0000 1.19
--- gas/listing.c 22 May 2002 15:33:05 -0000
*************** listing_newline (ps)
*** 390,397 ****
last_line = line;
last_file = file;
new_frag ();
!
if (listing_tail)
listing_tail->next = new;
else
--- 388,396 ----
last_line = line;
last_file = file;
+ #if 0
new_frag ();
! #endif
if (listing_tail)
listing_tail->next = new;
else
*************** listing_newline (ps)
*** 408,416 ****
new->hll_file = (file_info_type *) NULL;
new->hll_line = 0;
new->debugging = 0;
!
new_frag ();
!
#ifdef OBJ_ELF
/* In ELF, anything in a section beginning with .debug or .line is
considered to be debugging information. */
--- 407,415 ----
new->hll_file = (file_info_type *) NULL;
new->hll_line = 0;
new->debugging = 0;
! #if 0
new_frag ();
! #endif
#ifdef OBJ_ELF
/* In ELF, anything in a section beginning with .debug or .line is
considered to be debugging information. */