<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55608>55608</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            __wasm_apply_data_relocs is absolutely enormous
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          k1nder10
      </td>
    </tr>
</table>

<pre>
    We are porting a big project (>1'000'000 lines of code) to wasm using emscripten. Everything had worked fine until we started using dynamic linking (MAIN_MODULE=2 & SIDE_MODULE=2). Since then we are running into the issue of exceeding the function body size limit. This function is __wasm_apply_data_relocs and it's added by wasm-ld I believe.
We also noticed that this function is huge even in the targets where it fits the limit. (10-100x times bigger than the functions from our codebase). It feels like it does more work than actually needed.

What does this function actually do?
What does the size of this function depend on?
Are there any flags/features we can use to reduce its size?

It must be a common problem for every big project. Is it possible to split this function from our/your side somehow?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1U8lu2zAQ_RrpMohBSVFsH3Rw4QQw0LSHtOjRoMiRxJoiBS5x1K_vUM5eFDBorm-bUWvl3PxC4A5hsi4o0wOHVvUwOfsbRYCs3GTVbZGVa8bYZQStDHqwHQgrMSu3ECycuR8h-gSAoxdOTQHNCm4f0c1hSNsDl3C27oQSOgKAaILScEbwgbtAu5fXcjZ8VCKRnNKaBNzvDt-O99_3P7_eZtW-pK0beDjsb9_tkYoVPCgjEMKAJsEmTy4ak0CUIYl0AMr7iEk6PglEmc7SdheNCMoaaCkQ8OoPEv-owgp-DMq_HdP8eExWj3ya9HyUPPCjQ22FB24kqEAR0VRK8tPOSypXWsIBWtQKH3GVsX3Gdily7S0YG5Sgq2HggYZPVEPsEegRLcwik4LqMXg4D0jmVKAgaZVOntVSWAW7Khh7gqBGKhKVskeX8M0Ho0Tk7Ag2uqWILfe4RHggTETtCfC0MEhLKKMlulS7CxAXIXKtZzAUIcpnT8_OkpPl0Uc7r2-kzaq7f-_iJXWqzMd3EiekYK15fbVzS41p5GaGTvPeZ-VdhzxER1BUeUEao8fUlg5lFMmIX_BfQS4juR2jD1Qc6nphx5EIqfFbjSN01qXs3fz-c6CAfEplst4rupYo_KTV5-K9hEvC5pSxV5IM2hEHeyYNuWwqua22PA8qaGz-21OEyVtvdQxI0aGxbrTR59HpZghh8lm1Iwr69SoMsV2RB1po_fjyd_UsnJZL66eo6vqGbfKh6W64qMS1qLt6U1aFkDRrN7jG62LLeNfmmlPX-iarv2RlafB8-XpontX7XDUlK0tWl6woWF2vV3wr6qJar2_azWZNFNk1w5ErvUo6Vtb1uWsWSW2kil0zrXzwb4ecEu2poRY6wucxDNY1p8JIdAXLF-5m0f4XBf2b3Q">