public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* How to save and restore a symbol value in Aarch64?
@ 2017-04-20  9:16 Jeffrey Walton
  2017-04-20  9:27 ` Jeffrey Walton
  2017-04-20 10:03 ` Andreas Schwab
  0 siblings, 2 replies; 7+ messages in thread
From: Jeffrey Walton @ 2017-04-20  9:16 UTC (permalink / raw)
  To: Binutils

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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-04-20 19:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-20  9:16 How to save and restore a symbol value in Aarch64? Jeffrey Walton
2017-04-20  9:27 ` Jeffrey Walton
2017-04-20 10:03 ` Andreas Schwab
2017-04-20 10:55   ` Jeffrey Walton
2017-04-20 12:35     ` Jiong Wang
2017-04-20 13:57       ` Jeffrey Walton
2017-04-20 19:01       ` Jeffrey Walton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).