This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RE: Problem with gas macros
- From: "Arun Vishwanathan" <arun dot vishwanathan at nevisnetworks dot com>
- To: "Ian Lance Taylor" <ian at wasabisystems dot com>
- Cc: <binutils at sources dot redhat dot com>
- Date: Wed, 25 Feb 2004 20:44:18 +0530
- Subject: RE: Problem with gas macros
Thanks Ian. I understand the problem now.
Actually one of my macros did something like this and it worked.
.macro beq r1, r2,label
.short (0x6000 | \r1 << 8 | \r2 << 5 | ((\label - .) & 0x1F))
.endm
I now understand why this worked and the j macro did not.
An absolute value is generated for the expression (\label - .)
in this case and so the assembler is happy.
Regards.
> -----Original Message-----
> From: Ian Lance Taylor [mailto:ian@wasabisystems.com]
> Sent: Wednesday, February 25, 2004 8:14 PM
> To: Arun Vishwanathan
> Cc: binutils@sources.redhat.com
> Subject: Re: Problem with gas macros
>
>
> "Arun Vishwanathan" <arun.vishwanathan@nevisnetworks.com> writes:
>
> > I have written a gas macro as follows :
> >
> > .macro j label
> > .short (0xA000 | \label)
> > .endm
>
> In general this can not work. You can only apply the
> bitwise-or operator to absolute values. A label is not an
> absolute value; it will not become an absolute value until
> the linker assigns it a value.
>
> The wrong section error occurs because LABEL is not in the
> absolute section. We might be able to give a better error
> message here; it's an odd case that probably rarely arises.
>
> Ian
>