This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gas and prefix's on x86


>> >> > >>
>> >> > >> Can you do
>> >> > >>      lock; incw [eax]x;
>> >> >
>> >> > No, same results:
>> >> >
>> >> > t1.cpp:110: expected instruction opcode
>> >>
>> >> Use "lock/incw [eax]x" on linux, *bsd, i386aix.
>> >> "lock\incw [eax]x" on others.

>> Why don't we fix the assembler to accept prefixes
>> with a space instead of having to specify a seperator character?
>> (I'm guessing there is some history here?)

>> Hmm, actually, after fooling around a bit, I find that we do sometimes
>> accept prefixes with a space.. ie,
>> 
>>   lock incw (%eax)
>> 
>> is accepted quite happily.... The reason is that
>> the assembler doesn't munge this line into
>> 
>>     lock incw(%eax)
>> 
>> like it does with the '[' character.. so md_assemble()
>> sees the space between the incw and the operands.
>> 
>> This appears to be handled in do_scrub_chars() via a state machine. Im currentlylooking at that to see if we could be handling the '[' the same as we do
>> a '(' character...?
>> 


OK, so if we add the '[' character to extra_symbol_chars[] in tc-i386.c,
this prevents do_scrub_chars from removing the space. extra_symbol_chars
claims to be a list of characters that an operand can start with that aren't
in the generic list. Seems like we should put '[' in the list too?

This patch solves my problem quite nicely:


Andrew

	* config/tc-i386.c (extra_symbol_chars): Add '[' to the list.

Index: config/tc-i386.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/config/tc-i386.c,v
retrieving revision 1.172.12.1
diff -c -p -r1.172.12.1 tc-i386.c
*** tc-i386.c	2001/12/10 22:39:04	1.172.12.1
--- tc-i386.c	2002/04/29 20:42:34
*************** typedef struct _i386_insn i386_insn;
*** 149,157 ****
  /* List of chars besides those in app.c:symbol_chars that can start an
     operand.  Used to prevent the scrubber eating vital white-space.  */
  #ifdef LEX_AT
! const char extra_symbol_chars[] = "*%-(@";
  #else
! const char extra_symbol_chars[] = "*%-(";
  #endif
  
  /* This array holds the chars that always start a comment.  If the
--- 149,157 ----
  /* List of chars besides those in app.c:symbol_chars that can start an
     operand.  Used to prevent the scrubber eating vital white-space.  */
  #ifdef LEX_AT
! const char extra_symbol_chars[] = "*%-(@[";
  #else
! const char extra_symbol_chars[] = "*%-([";
  #endif
  
  /* This array holds the chars that always start a comment.  If the



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]