This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
How to save and restore a symbol value in Aarch64?
- From: Jeffrey Walton <noloader at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Thu, 20 Apr 2017 05:16:43 -0400
- Subject: How to save and restore a symbol value in Aarch64?
- Authentication-results: sourceware.org; auth=none
- Reply-to: noloader at gmail dot com
I'm trying to save (and restore) the original value of a symbol under
Aarch64. The code runs on a variety of machines, and it looks like I
need a solution for Binutils 2.24 and above.
I know .set allows me to set the symbol value:
asm(".set .cpu, generic+crc \n" ... );
I need the method to get the previous .cpu value and save it for the
restore. About all I have been able to do is cause assembler errors.
For example:
__inline unsigned int GCC_INLINE_ATTRIB
CRC32B(unsigned int crc, unsigned char v)
{
unsigned int r;
asm (".set old_cpu, .cpu \n"
".cpu generic+crc \n"
"crc32w %w2, %w1, %w0 \n"
".set .cpu, old_cpu \n"
: "=r"(r) : "r"(crc), "r"((unsigned int)v)
);
return r;
}
It results in:
Adding a leading dot results in:
My question is, how do I save and restore a symbol value for Binutils
2.2.4 and above on Aarch64?