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: [patch] MIPS gas problems with gcc's explicit relocs


>>>>> "Thiemo" == Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> writes:

 Thiemo> Paul Koning wrote: [snip] 
 >> and the compiler should always do the job, not the assembler,
 >> because the compiler can do it better.  So for the compiler to
 >> expand the multiple steps needed to load an address is correct.

 Thiemo> Sure, as far as no hand-written (inline) assembler code is
 Thiemo> affected.

Certainly.

 >> For example, if I use an "m" constraint, I'd expect the
 >> corresponding %x operand to become an offset and base register
 >> pair with a valid offset and the base register loaded with the
 >> rest of the address.

 Thiemo> That's not the way gcc up to 3.3 works for mips. So far, it
 Thiemo> was possible to write

 Thiemo> asm("ld\t%0,%1(%2)" : "=r" (foo) : "m" (bar), "r" (baz));

 Thiemo> and get something like

 Thiemo> #APP ld $2,bar($2) #NO_APP

That certainly is not what I expect from the documentation.  If you
need "bar" as a displacement, then it clearly is not a memory location
-- which is what "m" means.

 Thiemo> but now this results in

 Thiemo> #APP ld $2,%lo(bar)($3)($2) #NO_APP
	 
 Thiemo> which is of course invalid.

Yes, but that IS what the documentation says your asm statement
meant.  So I would argue that the current compiler is doing what you
asked for, and the previous compiler was doing something strange and
undocumented. 

I must admit I find myself fighting with constraints on MIPS at times
because things are not completely clear.  But I have always expected
(and, typically, observed) "m" to mean the "new" result you described,
certainly never the "old" result.

	  paul


 Thiemo> Thiemo


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