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


Hello Richard,

> I just wanted to point out that using %lo(...) in "m" constraints
> isn't in itself a new thing.  And that includes "m" constraints in
> inline asms, since gcc doesn't treat them any differently from "m"
> constraints in its own internal patterns.  For example, if you
> select non-abicalls o32 or o64 code, I think it's been possible
> for "m" to use %lo(...) for some time.  (Unless of course you
> disabled it via -mno-split-addresses.)

 Well, it certainly is not forbidden, but it's never happened to me with 
gcc 2.95.x.  I can't comment on anything between that and 3.4, though.

> If allowing %lo(...) in dla isn't acceptable (I've no opinion either
> way really), then we'll just have to call:
> 
> > 	asm("dla\t%0,%1" : "=r" (result) : "m" (foo));
> 
> ill-formed.  You should only use "m" if the instruction can handle
> every valid memory reference.

 Well, I think "la" and friends should accept any valid address that is
accepted by memory transfer instructions (it's "load address" after all --
why should it be selective on what "address" can be?).  I have no document
providing a grammar for "la" and friends, but it's pretty well described
in SGI's "MIPSpro Assembly Language Programmer's Guide;" for the purpose
of references, mine is document #007-2418-004.

 It lists "la" together with "lw" and other memory load instructions as
having "destination, address" operands (table 12, page 27).  So there's no
differentiation between these two kinds of instructions.  Then the format 
of "address" is specified as being one of (tables 7-8, pp 8-10):

- (base-register),

- expression,

- expression (base-register),

- index-register (base-register) (!),

- relocatable-symbol,

- relocatable-symbol +/- expression,

- relocatable-symbol +/- expression (index register).

There's no explicit reference to %reloc operators here and they're only
briefly mentioned elsewhere as a possibility to refer to relocations
explicitly (section 4.9, page 24).

 Thus I suppose the SGI assembler supports such constructs, as:

dla	$2,%lo(foo)($3)

As you seem to have an access to an Irix host, could you please verify it?
Given the above I suppose we should support:

dla	$2,$4($3)

as well. ;-)

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +


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