<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:out of range pc-relative fixup value"
href="https://bugs.llvm.org/show_bug.cgi?id=42539">42539</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ARM:out of range pc-relative fixup value
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>arnd@linaro.org
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>A file in the linux kernel got compiled into an invalid assembler output. I
reduced this to:
$ clang-9 -std=gnu89 --target=arm-linux-gnueabi -fsanitize=kernel-address -O2
-Wall -Wno-unused-value -Wno-parentheses-equality
-Wno-unused-command-line-argument -Wno-ignored-optimization-argument
/tmp/z-4fd29d.s:33: Error: bad immediate value for offset (4104)
typedef struct { long x[4 * 8 / 2]; } map_word;
struct {
void (*write)();
} g;
struct flchip {
long start;
int state;
} __attribute__((__packed__));
int a, b, c;
int fn2(void);
struct flchip d, h;
map_word e, f;
void fn1() {
g.write(e, h.start);
g.write(g, f, h.start);
while (({
for (; b;)
;
c;
}))
a = fn2();
asm(".rep 6; nop; .endr");
while (d.state)
;
}
See also <a href="https://godbolt.org/z/DSM2Jy">https://godbolt.org/z/DSM2Jy</a>
It seems that clang when clang tries to guess the size of the instructions in
an inline assembly, it gets the '.rep' statement wrong and assumes a smaller
number. Replacing ".rep 6; nop; .endr" with six straight nop instructions
avoids the problem.</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>