<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - Instprinter for AArch64 'adr/adrp' prints the wrong label"
href="https://llvm.org/bugs/show_bug.cgi?id=25030">25030</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Instprinter for AArch64 'adr/adrp' prints the wrong label
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>FreeBSD
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: AArch64
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>davide@freebsd.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>GNU objdump:
#######################
0000000000011000 <_start>:
11000: 10000021 adr x1, 11004 <msg>
Disassembly of section .R_AARCH64_ADR_PREL_PG_H121:
0000000000011012 <mystr-0x4>:
11012: 90000001 adrp x1, 11000 <_start>
#######################
llvm-objdump:
########################
Disassembly of section .R_AARCH64_ADR_PREL_LO21:
_start:
11000: 21 00 00 10 adr x1, #4
Disassembly of section .R_AARCH64_ADR_PREL_PG_H121:
$x.2:
11012: 01 00 00 90 adrp x1, #0
#########################
Testcase:
#############################
.section .R_AARCH64_ADR_PREL_LO21,"ax",@progbits
.globl _start
_start:
adr x1,msg
msg: .asciz "Hello, world\n"
msgend:
.section .R_AARCH64_ADR_PREL_PG_H121,"ax",@progbits
adrp x1,mystr
mystr:
.asciz "blah"
.size mystr, 4
#############################
This is particularly inconvenient because I use it for checking relocations in
lld. I think the issue is that AArch64InstPrinter::printAdrpLabel() just prints
the immediate shifted left by 12 position but doesn't add to this value the
value of PC with its bottom 12 bits cleared (i.e. Address of instruction &
~0xFFF).
I haven't found a way to easily get the PC -- ideas?</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>