<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [PPC64] V2 ABI: relocation R_PPC64_ADDR16_DS out of range when linking against c-runtime"
   href="https://bugs.llvm.org/show_bug.cgi?id=36798">36798</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[PPC64] V2 ABI: relocation R_PPC64_ADDR16_DS out of range when linking against c-runtime
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>ELF
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sfertile@ca.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>*** Note that testing was done with <a href="https://reviews.llvm.org/D44483">https://reviews.llvm.org/D44483</a> and an
experimental fix for <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [PPC64] V2 ABI: Functions global entry point sets the toc pointer to the wrong address."
   href="show_bug.cgi?id=36755">https://bugs.llvm.org/show_bug.cgi?id=36755</a>. The first
patch is needed to add support for the PPC64LE target as well as add the
missing .TOC. symbol.

When linking against the C runtime, a relocation in _start is out of range.
min_main.c:
int main(void) {
  return 55;
}

I got the verbose link command with:
~/install/LLD/bin/clang -fuse-ld=/home/sfertile/install/LLD/bin/ld.lld  -v
min_main.c


"/home/sfertile/install/LLD/bin/ld.lld"                                     \
-z relro --hash-style=gnu --eh-frame-hdr                                    \
-m elf64lppc                                                                \
-dynamic-linker /lib64/ld64.so.2                                            \
-o a.out                                                                    \
/usr/lib/powerpc64le-linux-gnu/crt1.o                                       \
/usr/lib/powerpc64le-linux-gnu/crti.o                                       \
/home/llvm/gcc/7.3.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.3.0/crtbegin.o \
-L/home/llvm/gcc/7.3.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.3.0          \
-L/home/llvm/gcc/7.3.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.3.0/../../../../lib64
\
-L/lib/powerpc64le-linux-gnu                                                \
-L/lib/../lib64                                                             \
-L/usr/lib/powerpc64le-linux-gnu                                            \
-L/home/llvm/gcc/7.3.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.3.0/../../.. \
-L/home/sfertile/install/LLD/bin/../lib                                     \
-L/lib                                                                      \
-L/usr/lib                                                                  \
`pwd`/min_main.o                                                            \
-lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s
--no-as-needed \
/home/llvm/gcc/7.3.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.3.0/crtend.o    \
/usr/lib/powerpc64le-linux-gnu/crtn.o


error: /usr/lib/powerpc64le-linux-gnu/crt1.o:(function _start): relocation
R_PPC64_ADDR16_DS out of range: -98664 is not in [-32768, 32767]</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>