[llvm-bugs] [Bug 26030] New: On arm64 with mcmodel=large and fPIC clang produces code with absolute relocations

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 5 07:30:05 PST 2016


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

            Bug ID: 26030
           Summary: On arm64 with mcmodel=large and fPIC clang produces
                    code with absolute relocations
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: phcoder at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Happens when dereferencing a string.
Sample code:
phcoder at sid:16:25:30:~/grub2$ cat clang-arm64.c
const char *tst(void) {
  return "x";
}

Compilation:
phcoder at sid:16:23:46:~/grub2$ clang-3.8 -target aarch64-linux-gnu -fPIC -o 1.o
clang-arm64.c -c -mcmodel=large
clang version:
phcoder at sid:16:25:29:~/grub2$ clang-3.8 -v
Debian clang version 3.8.0-svn254193-1 (trunk) (based on LLVM 3.8.0)
Resultion object file:

1.o:     file format elf64-littleaarch64


Disassembly of section .text:

0000000000000000 <tst>:
tst():
   0:    d2e00008     movz    x8, #0x0, lsl #48
            0: R_AARCH64_MOVW_UABS_G3    .rodata.str1.1
   4:    f2c00008     movk    x8, #0x0, lsl #32
            4: R_AARCH64_MOVW_UABS_G2_NC    .rodata.str1.1
   8:    f2a00008     movk    x8, #0x0, lsl #16
            8: R_AARCH64_MOVW_UABS_G1_NC    .rodata.str1.1
   c:    f2800008     movk    x8, #0x0
            c: R_AARCH64_MOVW_UABS_G0_NC    .rodata.str1.1
  10:    aa0803e0     mov    x0, x8
  14:    d65f03c0     ret

Expected results:
No absolute relocations
Actual results:
absolute relocations R_AARCH64_MOVW_UABS_G*

-- 
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/20160105/235de1a4/attachment.html>


More information about the llvm-bugs mailing list