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

    <tr>
        <th>Summary</th>
        <td>
            Intermittent crash in LLVM when used from OSL (Open Shading Language) in interactive use case (seemingly due to 32 bit relocation offsets?)
        </td>
    </tr>

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

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

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

<pre>
    I reported this bug first as an OSL bug here: https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/issues/1712 but it seems the "bug" is in LLVM itself.

TL;DR - in a heavey interactive session when compiling OSL shaders _while_ rendering high-resolution images, we sometimes, super-intermittently, seemingly randomly, end up crashing here:

![image](https://github.com/llvm/llvm-project/assets/102356572/3cfbe0bb-fe70-43a6-847a-388ed364302c)

Basically, whatever assumptions is being made of memory blocks being within 2Gb of each other, do not hold (probably cause other threads have been allocating multi-gigabyte chunks in the meantime).

This of course explains the intermittent behavior of the bug, and that it only happens while heavy things are happening concurrently in other threads (which has made it quite difficult to track down.)

Not understanding much of LLVM, but realizing that 32 bit offsets is highly likely not to be enough, as a test, I made an ugly hackaround and replaced the use of IMAGE_REL_AMD64_ADDR32NB relocations (which seems to be the 32 bit offsets) with IMAGE_REL_AMD64_ADDR64 (which looks to my eye as full 64 bit offsets?) and the problem goes away!! 

But being an utter LLVM coding noob, I sincerely doubt this is the "right solution".

For the "long explanation", see the issue in the OSL GitHub linked above, including my "godawful hackaround".

What is the "right solution" here, or are we doing something fundamentally wrong somewhere?




</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVU1v4zYQ_TX0ZeBApmzZPvjgrNfbANldYLdogV6CETUS2VCkyo-o6q8vSDmJvWgL9CJD4ng4896bN-i96gzRgW3u2ea0wBikdYffcDiahpz31ixq20yHB3A0WBeogSCVhzp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