<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 - arm assembler incorrectly re-uses previously allocated literal pool entries"
href="https://bugs.llvm.org/show_bug.cgi?id=32825">32825</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>arm assembler incorrectly re-uses previously allocated literal pool entries
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dimitry@andric.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>This is a test case derived from webkit-gtk[23], where it apparently was inline
assembly, but having it as a separate file is easier for reproduction:
======================================================================
$ cat lli1.s
.text
# Assembler allocates slot in literal pool
# and puts 1234 into it.
ldr r0, =1234
# Literal pool is flushed at this place.
.ltorg
# Actual result:
# 0: e51f0004 ldr r0, [pc, #-4] ; 4 <.text+0x4>
# 4: 000004d2 .word 0x000004d2
# Move PC outside of relative addressing range.
.=. + 4096
# Assembler incorrectly reuses previously
# allocated slot in literal pool even if its
# outside of of addressable range for
# ldr r0, [pc, #xxx]
ldr r0, =1234
.ltorg
# Expected result:
# 1008: e51f0004 ldr r0, [pc, #-4] ; 100c <.text+0x100c>
# 100c: 000004d2 .word 0x000004d2
======================================================================
With GNU as, assembling this example works just fine:
======================================================================
$ arm-gnueabi-freebsd-as -v -o lli1.o lli1.s
GNU assembler version 2.28 (arm-gnueabi-freebsd) using BFD version (GNU
Binutils) 2.28
$ arm-gnueabi-freebsd-objdump -d lli1.o
lli1.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <.text>:
0: e51f0004 ldr r0, [pc, #-4] ; 4 <.text+0x4>
4: 000004d2 .word 0x000004d2
...
1008: e51f0004 ldr r0, [pc, #-4] ; 100c <.text+0x100c>
100c: 000004d2 .word 0x000004d2
======================================================================
E.g. the assembler recognizes the first literal pool is too far away, and puts
the same constant in a new literal pool.
In contrast, clang trunk r300422 cannot assemble this:
======================================================================
$ clang -cc1as -triple arm---eabi -filetype obj -o lli1.o lli1.s
lli1.s:19:2: error: out of range pc-relative fixup value
ldr r0, =1234
^
======================================================================
Obviously the fixup value is not out range, it simply fails to create a new
literal pool.</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>