[llvm-bugs] [Bug 49525] New: 'P' inline assembly operand modifier should obey -fno-plt
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 10 14:08:44 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49525
Bug ID: 49525
Summary: 'P' inline assembly operand modifier should obey
-fno-plt
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: thiago at kde.org
CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, pengfei.wang at intel.com,
spatel+llvm at rotateright.com
Unlike GCC, Clang seems not to print the "@PLT" suffix for the 'P' constraint
in PIC mode:
$ cat test.c
extern void f(void);
void g() { asm("call %P0 # asm" : : "X" (f)); }
int h() { f(); return 0; }
$ clang -fno-pic -S -o - -O2 test.c | grep call
callq f # asm
callq f
$ clang -fPIC -S -o - -O2 test.c | grep call
callq f # asm
callq f at PLT
$ gcc -fPIC -S -o - -O2 test.c | grep call
call f at PLT # asm
call f at PLT
That's not a big deal because the linker will generate the PLT anyway if the
function is defined in a shared library being linked.
But the call violates -fno-plt:
$ clang -fno-pic -S -o - -O2 test.c | grep call
callq f # asm
callq *f at GOTPCREL(%rip)
$ clang -fPIC -S -o - -O2 test.c | grep call
callq f # asm
callq *f at GOTPCREL(%rip)
$ gcc -fPIC -S -o - -O2 test.c | grep call
call f at PLT # asm
call *f at GOTPCREL(%rip)
Equivalent GCC bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99530
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210310/8228c3b0/attachment-0001.html>
More information about the llvm-bugs
mailing list