public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "thiago at kde dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/99530] [i386] 'P' inline assembly operand modifier should obey -fno-plt
Date: Thu, 11 Mar 2021 22:38:51 +0000 [thread overview]
Message-ID: <bug-99530-4-gyjmseg7un@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99530-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99530
--- Comment #13 from Thiago Macieira <thiago at kde dot org> ---
> Since my patch uses output_asm_insn to finish the instruction, %P must be
> the last operand.
Okay.
If I wanted to abuse, I could just swap it around:
$ ~/dev/gcc/bin/gcc -fPIC -fno-plt -S -o - -O2 -xc - <<<'extern void f(void);
void g() { asm("cmp%z0 $0, %P0" : : "X" (f)); }' | grep GOTPC
cmpq $0, *f@GOTPCREL(%rip)
I can't see the need to do that.
The reason I needed to "call %P0" was to call an assembly function that did not
respect the ABI (intel-ipsec-mb's sha512_x8_avx512). The code looks like this:
#ifdef _WIN32
# define EXTRA_CLOBBER "rsi", "rdi",
# define OUT0 "+c" /* rcx */
# define OUT1 "+d" /* rdx */
#else
# define EXTRA_CLOBBER "rcx", "rdx",
# define OUT0 "+D" /* rdi */
# define OUT1 "+S" /* rsi */
#endif
extern void sha512_x8_avx512(void *data, size_t size_in_blocks);
__asm__ volatile ("call %P[func]"
: OUT0 (data),
OUT1 (size_in_blocks),
"+m" (*(char (*)[])data)
: [func] "X" (sha512_x8_avx512)
:
// caller-save registers
"rax", "r8", "r9", "r10", "r11",
EXTRA_CLOBBER
// the current implementation does not use RBX and RBP
// "rbx", "rbp",
// the current implementation does clobber these callee-save registers
"r12", "r13", "r14", "r15"
);
https://github.com/intel/intel-ipsec-mb/blob/master/lib/avx512/sha512_x8_avx512.asm#L417
next prev parent reply other threads:[~2021-03-11 22:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 21:51 [Bug target/99530] New: " thiago at kde dot org
2021-03-10 22:04 ` [Bug target/99530] " thiago at kde dot org
2021-03-11 13:31 ` hjl.tools at gmail dot com
2021-03-11 15:02 ` hjl.tools at gmail dot com
2021-03-11 16:00 ` thiago at kde dot org
2021-03-11 16:01 ` thiago at kde dot org
2021-03-11 16:06 ` thiago at kde dot org
2021-03-11 19:02 ` hjl.tools at gmail dot com
2021-03-11 21:03 ` thiago at kde dot org
2021-03-11 21:53 ` hjl.tools at gmail dot com
2021-03-11 22:14 ` thiago at kde dot org
2021-03-11 22:27 ` hjl.tools at gmail dot com
2021-03-11 22:28 ` hjl.tools at gmail dot com
2021-03-11 22:38 ` thiago at kde dot org [this message]
2021-03-13 16:42 ` hjl.tools at gmail dot com
2021-03-17 14:32 ` hjl.tools at gmail dot com
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=bug-99530-4-gyjmseg7un@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.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).