From: Jeffrey Walton <noloader@gmail.com>
To: Binutils <binutils@sourceware.org>
Subject: Re: How to save and restore a symbol value in Aarch64?
Date: Thu, 20 Apr 2017 09:27:00 -0000 [thread overview]
Message-ID: <CAH8yC8=+OuGdr4h9Hwm4F+GCG_N5bgFqW1S+1aPUhegB6u2JYw@mail.gmail.com> (raw)
In-Reply-To: <CAH8yC8m4ReBF_eY5B_Xs28G0-XYey0dBMssBo+X0pzi-3=OYeg@mail.gmail.com>
On Thu, Apr 20, 2017 at 5:16 AM, Jeffrey Walton <noloader@gmail.com> wrote:
> 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?
Sorry about the truncated message. Here are the error messages.
For ".set old_cpu, .cpu \n" (no leading dot):
/tmp/ccbAvT3u.s: Assembler messages:
/tmp/ccbAvT3u.s:32: Error: unknown mnemonic `old_cpu' -- `old_cpu .equ .cpu'
/tmp/ccbAvT3u.s:35: Error: unknown mnemonic `set' -- `set .cpu,old_cpu'
For ".set .old_cpu, .cpu \n" (leading dot):
/tmp/cc0r6bvh.s: Assembler messages:
/tmp/cc0r6bvh.s:32: Error: unknown pseudo-op: `.old_cpu'
Here's the relevant AS manual section that discusses symbols:
http://tigcc.ticalc.org/doc/gnuasm.html#SEC45
Jeff
next prev parent reply other threads:[~2017-04-20 9:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-20 9:16 Jeffrey Walton
2017-04-20 9:27 ` Jeffrey Walton [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH8yC8=+OuGdr4h9Hwm4F+GCG_N5bgFqW1S+1aPUhegB6u2JYw@mail.gmail.com' \
--to=noloader@gmail.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).