<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 - [WebAssembly] undefined symbol: __heap_base"
   href="https://bugs.llvm.org/show_bug.cgi?id=43934">43934</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[WebAssembly] undefined symbol: __heap_base
          </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>other
          </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>wasm
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, sbc@chromium.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>wasm-ld has code to define __heap_base, however it doesn't appear to be defined
when __heap_base is referenced.

Here's a reduced testcase; compile with -nostdlib:

```
void *volatile p;
extern void __heap_base;

void _start(void) {
    p = &__heap_base;
}
```

I get this error:

```
$ clang -nostdlib test.c 
wasm-ld: error: /tmp/s-01d300.o: undefined symbol: __heap_base
```

This comes up in wasi-libc, as of this PR:

<a href="https://github.com/CraneStation/wasi-libc/pull/114">https://github.com/CraneStation/wasi-libc/pull/114</a></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>