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


On Fri, 4 Jun 2004 cgd@broadcom.com wrote:

> > > - Work around the problem by not using "m" constraints for (d)la in
> > >   the inline assembler, that is instead of
> > > 
> > > 	asm("dla\t%0,%1" : "=r" (result) : "m" (foo));
> > > 
> > >   something like
> > > 
> > > 	asm("dla\t%0,foo" : "=r" (result));
> > 
> > I like this I think the most. It fits with what people are trying to do
> > with the la instruction, i.e. load an address for a symbol that they
> > know.
[...]
> assuming there are no other references to 'foo' in the file, this can
> lose w/ unit-at-a-time compilation (e.g., if 'foo' is a static data
> object).  Need to reference 'foo' from C code.
> 
> Also, historically speaking, putting 'foo' in the asm might have been
> a bad idea, because of of the question of underscores or not at the
> start of C symbols.  Nicer to let the compiler take care of it for
> you.  (not clear that this matters today, though.)

 I suppose this should work anyway with the asm label GCC extension, like 
this:

int foo asm ("foo");

It doesn't work for automatic variables, though (no surprise).

-- 
+  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]