<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Clang assembler does not recognize long jumps for x86 intel assembly"
href="https://bugs.llvm.org/show_bug.cgi?id=50292">50292</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang assembler does not recognize long jumps for x86 intel assembly
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Driver
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>iankronquist@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>When clang is invoked on an assembly file, I expect it to be compatible with
gcc and binutils as.
When using Intel syntax, clang does not properly assemble the x86 long jump
instruction, used to reload the code segment descriptor. This happens in
.code16 and .code32 mode.
Here is an example that will assemble with gcc and binutils as, but not with
clang:
```
ian@iankhome:~/k2$ cat bug.S
.intel_syntax noprefix
.code16
.text
.global _start
_start:
jmp 0:.canonicalized_ip
.canonicalized_ip:
jmp 0x18:.protected
.code32
.protected:
jmp 0x28,.long_mode
.long_mode:
ian@iankhome:~/k2$ clang-11 -c bug.S
bug.S:7:7: error: unexpected token in argument list
jmp 0:.canonicalized_ip
^
bug.S:9:10: error: unexpected token in argument list
jmp 0x18:.protected
^
bug.S:12:5: error: invalid operand for instruction
jmp 0x28,.long_mode
^
ian@iankhome:~/k2$ gcc -c bug.S
ian@iankhome:~/k2$ as -c bug.S
ian@iankhome:~/k2$ clang-11 --version
Ubuntu clang version 11.0.0-2~ubuntu20.04.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
ian@iankhome:~/k2$ as --version
GNU assembler (GNU Binutils for Ubuntu) 2.34
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
ian@iankhome:~/k2$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
Adding the clang command line flags -masm=intel doesn't change clang's
behavior.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>