<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 - wasm32: Allow placing the stack before global data"
   href="https://bugs.llvm.org/show_bug.cgi?id=37181">37181</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wasm32: Allow placing the stack before global data
          </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>Windows NT
          </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>alex@crichton.co
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dan433584@gmail.com, llvm-bugs@lists.llvm.org, sbc@chromium.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>We've been having some discussions in Rust about the memory layout of wasm
modules (<a href="https://github.com/rust-lang-nursery/rust-wasm/issues/81">https://github.com/rust-lang-nursery/rust-wasm/issues/81</a>) and one
thing we're wondering is how to best catch stack overflow
(<a href="https://github.com/rust-lang-nursery/rust-wasm/issues/141">https://github.com/rust-lang-nursery/rust-wasm/issues/141</a>). Currently a stack
overflow will silently corrupt static data unfortunately and can be difficult
to diagnose, and the default stack size is 64 kilobytes which is a pretty
small! (it's our own issue though we should tweak that by default).

Would it be possible to have an option in LLD to place the stack before global
data? That way the stack could never corrupt global data and stack overflow
would always result in running below the address 0, almost guaranteed to be out
of bounds.

I'm not sure if this would be a great default to enable, but being able to
tweak this for experimentation might also be good to have!</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>