<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 - X86: Stack probe symbol has wrong linkage while compiling a shared object"
   href="https://bugs.llvm.org/show_bug.cgi?id=35463">35463</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>X86: Stack probe symbol has wrong linkage while compiling a shared object
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>Target Description Classes
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ales.hrabalik@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19485" name="attach_19485" title="Nasty hack that fixes the issue for us">attachment 19485</a> <a href="attachment.cgi?id=19485&action=edit" title="Nasty hack that fixes the issue for us">[details]</a></span>
Nasty hack that fixes the issue for us

We build ELF objects on Windows. Everything seemed to be working fine until we
compiled some code that uses dynamic stack allocation, and tried to link it
into a shared library (executable linking works fine). Here is a minimal
example that produces the error we observed:

// minimal example -- commands //
clang++ --target=x86_64-pc-windows-elf -c foo.cpp
ld.lld -shared foo.o -o foo

// minimal example -- foo.cpp //
int foo(int x) {
    void *p = __builtin_alloca( x );
    return (int)p;
}

// minimal example -- lld error //
D:\build\llvm-install-release\bin\ld.lld.exe: error: can't create dynamic
relocation R_X86_64_PC32 against symbol: __chkstk in readonly segment;
recompile object files with -fPIC
<span class="quote">>>> defined in foo.o
>>> referenced by foo.cpp
>>>               foo.o:(foo(int))</span >

We have tracked the bug to X86FrameLowering.cpp. Attached is a small, nasty
hack that fixes the problem for us. It is probably not a good solution, but the
library links now.</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>