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

    <tr>
        <th>Summary</th>
        <td>
            [libunwind] Feature Request: Improved baremetal support for libunwind. 
        </td>
    </tr>

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

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

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

<pre>
    For bare-metal SMP targets like `<ARCH>-none-elf`, it can be useful to enable libunwind even if exceptions aren't being used. This usually happens if the ABI being targeted doesn't support stacktracing with just the stack frame. 

Currently libunwind RWMutex assumes a standard threading library is present or threading is entirely disabled. This adds extra steps in getting libunwind functioning on unconventional SMP systems. 

It would be nice if there was a build option to use a spin-lock based solution. It obviously has some performance overheads compared to a true threading library,  but given that bare metal embedded shouldn't really be using exceptions this is probably not a problem. 

If there's interest in this kind of solution, I can provide a spin-lock based RWLock implementation along with a Relacy model for verification. I don't know what other testing the maintainers would want to see before merging in such a change though.  
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxslF-P6jYQxT-NeRmBQrLA7kMe9k9RUXulila6z-N4kvji2KlnDMu3r2zY7fbPCyix53jmd06MzHbwRK3avKjN2wKTjCG2Lw6nX-zFLnQw13YfImiMtJxI0MHv334DwTiQMDh7IlDbSjWvz8fXn1Xz09IHT0tyfX5bv4IV6NCDJkhMfXIgAcijdgTO6uQv1hugM3mwPdB7R7PY4Bkwklf1TkCT9UMuNiv4Y7QMiRM6d4UR55k85zoZCZ5fDve9t-bIgAnENxFO8xyiAAt2J4nY5X0XKyP8SCylvixBH3GiFajqTVXPt9_XFCN5cdcvDR-_f0tC74DMaSIGzOXeYDQgYyQ0Wd9ZHTFewTLMkZi8QIhf1i0DebGR3BWM5czkY0Y0hoHeJWZhmhmsh4FE7rL3Lvrku0wrvw0eku-CP2fJ4O8-8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