Re: Error: unknown pseudo-op: `.arch_extension'

2017-04-20 Thread Jim Wilson
On Wed, Apr 19, 2017 at 11:35 PM, Jeffrey Walton  wrote:
> On Wed, Apr 19, 2017 at 9:57 PM, Jim Wilson  wrote:
>> On Wed, Apr 19, 2017 at 12:38 PM, Jeffrey Walton  wrote:
> The thing I am not sure about is saving and restoring the cpu. The AS
> manual states "Specifying .cpu clears any previously selected
> architecture extensions". But arch_extensions does not seem to work,
> so I guess its a moot point. Also, the manual only discusses '.set' in
> the context of MIPS. The program below does not produce a warning or
> error. I am not sure if its doing what's expected.

For a non-mips target, .set is the same as .equ and =, it sets a
symbol value to an expression.  Your code using .set push and .set pop
isn't doing anything useful.

I don't see any mechanism in the assembler to save/restore a cpu
setting.  There is one in gcc, but not until gcc 6.

I don't see any easy solution for you at the moment, you need a
binutils/gcc upgrade, or you need to put crc code in separate files.
Or you could force all files to be compiled with -mcpu=generic, and
then you can use .cpu to add/remove crc support as necessary.

Jim
___
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/linaro-toolchain


Re: Error: unknown pseudo-op: `.arch_extension'

2017-04-20 Thread Jeffrey Walton
> I don't see any easy solution for you at the moment, you need a
> binutils/gcc upgrade, or you need to put crc code in separate files.
> Or you could force all files to be compiled with -mcpu=generic, and
> then you can use .cpu to add/remove crc support as necessary.

Thanks Jim. This came from Jiong Wang on the Binutils mailing list
(https://sourceware.org/ml/binutils/2017-04/msg00171.html):

__inline unsigned int GCC_INLINE_ATTRIB
CRC32B(unsigned int crc, unsigned char v)
{
unsigned int r;
asm ("\t.set raw_x0, 0\n"
 "\t.set raw_x1, 1\n"
 "\t.set raw_x2, 2\n"
 "\t.set raw_x3, 3\n"
 "\t.set raw_x4, 4\n"
 "\t.set raw_x5, 5\n"
 "\t.set raw_x6, 6\n"
 "\t.set raw_x7, 7\n"
 "\t#crc32w %w2, %w1, %w0\n"
 "\t.inst\t0x1ac04800 | (raw_%2) | (raw_%1 << 5) | (raw_%0 << 16)\n"
 : "=r"(r) : "r"(crc), "r"((unsigned int)v)
);
return r;
}

Thanks for the help (and thanks to the Binutil folks). I would not
have gotten this far on my own.

Jeff
___
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/linaro-toolchain