<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 - WASM backend cannot build libcxx - fails on .text.__startup section"
   href="https://bugs.llvm.org/show_bug.cgi?id=35414">35414</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>WASM backend cannot build libcxx - fails on .text.__startup section
          </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>Linux
          </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>Backend: WebAssembly
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ncw@realvnc.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Another problem found from building libcxx.  This time, it fails generating a
WASM data section.

fatal error: error in backend: only data supported in data sections
clang-6.0: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 6.0.0 (trunk 318652)
Target: wasm32-unknown-unknown-wasm
Thread model: single
InstalledDir: /home/ncw/workspace/llvm/llvm/bld/bin
clang-6.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.


I've isolated the problem, down to a minimal example that focuses on the use of
function pointers in the ".text.__startup" section.

I'll have a look at seeing how to integrate this with LLD - perhaps via
emitting a custom section that contains a list of the function indices to put
together into a generated section, or maybe simply putting in a named WASM
"data" section that contain the indices into the allfuncs table, for use by
libc to run them during the entry-point.

Has anyone decided what the WASM ABI for this is going to be?


=== Minimal example ===

extern void extFn();

struct TestData {
  TestData() { extFn(); }
} testData;

void expFn() {}</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>