[llvm-bugs] [Bug 32530] New: inline assembly incompatibility between gcc and clang - mov with offset in intel dialect
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Apr 5 00:08:40 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=32530
Bug ID: 32530
Summary: inline assembly incompatibility between gcc and clang
- mov with offset in intel dialect
Product: libraries
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: superjoe30 at gmail.com
CC: llvm-bugs at lists.llvm.org
I believe I have found one of these "as-needed" cases for inline assembly:
> LLVM’s support is often implemented on an ‘as-needed’ basis, to support C inline asm code which was supported by GCC. A mismatch in behavior between LLVM and GCC likely indicates a bug in LLVM.
Here is a simple program to print "Hello, world!" on x86_64 Linux:
.intel_syntax noprefix
.text
.globl _start
_start:
mov rax, 1
mov rdi, 1
mov rsi, offset msg
mov rdx, 14
syscall
mov rax, 60
mov rdi, 0
syscall
.data
msg:
.ascii "Hello, world!\n"
GCC:
$ gcc -o hello hello.s -nostdlib && ./hello
Hello, world!
Clang:
$ clang -o hello hello.s -nostdlib && ./hello
hello.s:8:24: error: unknown token in expression
mov rsi, offset msg
^
I believe the `offset` keyword is the only way to emit a `mov` with the
effective address instead of the dereferenced address.
Related to https://bugs.llvm.org/show_bug.cgi?id=22511
More details: http://stackoverflow.com/questions/43223287/
--
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/20170405/3d861b87/attachment.html>
More information about the llvm-bugs
mailing list