[llvm-bugs] [Bug 25030] New: Instprinter for AArch64 'adr/adrp' prints the wrong label

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 2 11:08:00 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25030

            Bug ID: 25030
           Summary: Instprinter for AArch64  'adr/adrp' prints the wrong
                    label
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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", at progbits
.globl _start
_start:
  adr x1,msg
msg:  .asciz  "Hello, world\n"
msgend:
.section .R_AARCH64_ADR_PREL_PG_H121,"ax", at 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?

-- 
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/20151002/dada6e55/attachment.html>


More information about the llvm-bugs mailing list