<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 --- - On arm64 with mcmodel=large and fPIC clang produces code with absolute relocations"
   href="https://llvm.org/bugs/show_bug.cgi?id=26030">26030</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>On arm64 with mcmodel=large and fPIC clang produces code with absolute relocations
          </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>normal
          </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>phcoder@gmail.com
          </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>Happens when dereferencing a string.
Sample code:
phcoder@sid:16:25:30:~/grub2$ cat clang-arm64.c
const char *tst(void) {
  return "x";
}

Compilation:
phcoder@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@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*</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>