<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 - Linking error: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFvvE.generalized_align"
   href="https://bugs.llvm.org/show_bug.cgi?id=38200">38200</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Linking error: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFvvE.generalized_align
          </td>
        </tr>

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

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

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>tom@ritter.vg
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre><span class="quote">> clang version 7.0.0 (trunk) (llvm/trunk 337005)
> Target: x86_64-unknown-linux-gnu</span >

The following code was compiled into a .o :

>
<span class="quote">>  if (aType & nsCFIType::ICALL_INVALID_ENTRY_POINT) {</span >
>
<span class="quote">>    int val = setjmp(env);</span >
>
<span class="quote">>    if (val == 0) {
>      fn_ptr slide_to_the_left = (fn_ptr)((uintptr_t)(not_entry_point) + 0x20);
>      slide_to_the_left();  // Line 690
>    }</span >
>
<span class="quote">>    return NS_OK;
>  }</span >
>
>
<span class="quote">>  if (aType & nsCFIType::ICALL_INVALID_SIGNATURE) {
>    int_arg_fn get_down_now_yall = (int_arg_fn)int_arg;</span >
>
<span class="quote">>    int ret = get_down_now_yall(5);  // Line 709</span >
>
<span class="quote">>    get_down_now_yall = (int_arg_fn)float_arg;
>    ret = get_down_now_yall(5);  // Line 713</span >
>
<span class="quote">>    return NS_OK;
>  }</span >

And then linked with the following command:

<span class="quote">> ../../../../../../../../clang++ \
> -fuse-ld=lld \
> -flto=thin \
> -fsanitize=cfi-icall \
> -pipe \
> -g \
> -fPIC \
> -shared \
> -o \
> libxul.so \
> trimmed_tmp.list \
> -fcolor-diagnostics \
> -Wl,--error-limit,0</span >

It yields the following errors:

<span class="quote">> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFvvE.generalized_align
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:0 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:0)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))</span >

<span class="quote">> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFvvE.generalized_size_m1
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:690 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:690)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))</span >

<span class="quote">> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFiiE.generalized_align
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:0 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:0)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))</span >

<span class="quote">> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFiiE.generalized_size_m1
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:709 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:709)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))</span >

<span class="quote">> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFiiE.generalized_align
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:0 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:0)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))</span >

<span class="quote">> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFiiE.generalized_size_m1
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:713 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:713)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))</span >



The reproduction steps are:

<span class="quote">> wget <a href="https://ritter.vg/misc/transient/R_X86_64_PC32.tgz">https://ritter.vg/misc/transient/R_X86_64_PC32.tgz</a>
> tar xf R_X86_64_PC32.tgz
> cd xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library
> # Clear your terminal
> # Run the above compile command; search for R_X86_64_PC32</span >


I tried to reproduce the compilation command to take it from the source code to
the .o file; but had a lot of difficulty doing that, so I decided to file this
with what I had. My file is too large to attach to bugzilla; but it is
minimized as much as I could, down from 2 GB and 1000+ object files.</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>