This is the mail archive of the binutils@sourceware.org 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]

How to save and restore a symbol value in Aarch64?


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]