<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-ld] zlib crash"
   href="https://bugs.llvm.org/show_bug.cgi?id=41802">41802</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[wasm-ld] zlib crash
          </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>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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>alonzakai@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21911" name="attach_21911" title="all files but libc (too big with it all together)">attachment 21911</a> <a href="attachment.cgi?id=21911&action=edit" title="all files but libc (too big with it all together)">[details]</a></span>
all files but libc (too big with it all together)

This crashes:

wasm-ld src_0.o libz.a libc.bc libc-wasm.bc libdlmalloc.bc libpthreads_stub.bc
libcompiler_rt.a libcompiler_rt_wasm.a libc_rt_wasm.a -mllvm
-combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm
-disable-lsr --export __wasm_call_ctors --export __data_end --export main
--export malloc --export free --export setThrew --export __errno_location
--export fflush -z stack-size=5242880 --initial-memory=16777216 --no-entry
--max-memory=16777216 --global-base=1024 -o src.c.o.wasm --allow-undefined
--import-memory --import-table --lto-O0

and the crash says it is on

lld::wasm::FunctionSymbol::getFunctionIndex()

Valgrind confirms with "Invalid read of size 1" on that function.

Noticed this when working on
<a href="https://github.com/emscripten-core/emscripten/pull/8550">https://github.com/emscripten-core/emscripten/pull/8550</a> , that is, when getting
emscripten to properly test LTO. The attached files are from running
wasmlto0.test_zlib on that PR (specifically
84d61dac52c8a74898bb953916d0f4654348163e).</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>