<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 --- - llvm uses GOT to access locally defined variable for PIE"
   href="https://llvm.org/bugs/show_bug.cgi?id=24964">24964</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm uses GOT to access locally defined variable for PIE
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hjl.tools@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, michael.m.kuperstein@intel.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>On x86-64, llvm uses GOT to access locally defined variable for PIE.
GOT shouldn't be needed:

[hjl@gnu-32 bin]$ cat x.c
int i;

int
foo (void)
{
  return i;
}
[hjl@gnu-32 bin]$ ./clang -S -O2 -fPIE -m64 x.c
[hjl@gnu-32 bin]$ cat x.s
    .text
    .file    "x.c"
    .globl    foo
    .align    16, 0x90
    .type    foo,@function
foo:                                    # @foo
    .cfi_startproc
# BB#0:
    movq    i@GOTPCREL(%rip), %rax
    movl    (%rax), %eax
    retq
.Lfunc_end0:
    .size    foo, .Lfunc_end0-foo
    .cfi_endproc

    .type    i,@object               # @i
    .comm    i,4,4
[hjl@gnu-32 bin]$ gcc  -S -O2 -fPIE -m64 x.c
[hjl@gnu-32 bin]$ cat x.s
    .file    "x.c"
    .section    .text.unlikely,"ax",@progbits
.LCOLDB0:
    .text
.LHOTB0:
    .p2align 4,,15
    .globl    foo
    .type    foo, @function
foo:
.LFB0:
    .cfi_startproc
    movl    i(%rip), %eax
    ret
    .cfi_endproc
.LFE0:
    .size    foo, .-foo
    .section    .text.unlikely
.LCOLDE0:
    .text
.LHOTE0:
    .comm    i,4,4
[hjl@gnu-32 bin]$</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>