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

    <tr>
        <th>Summary</th>
        <td>
            [lld] After 46453119335, internal linker error: wrote incorrect addend value 0x74C08500 instead of 0x0 for dynamic relocation R_386_32 at offset 0x4016C7 against symbol __gxx_personality_v0
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lld:ELF
      </td>
    </tr>

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

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

<pre>
    As reported in https://pkg-status.freebsd.org/gohan05/data/maini386PR265425-default/2022-12-06_12h24m32s/logs/errors/openal-soft-1.21.1_3.log, linking openal-soft's`sofa-info` and `makemhr` tools while targeting i386-freebsd results in errors of the form:

```text
: && /usr/bin/c++ -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -DNDEBUG -Wl,--as-needed -fstack-protector-strong -Wl,-z,notext CMakeFiles/makemhr.dir/utils/makemhr/loaddef.cpp.o CMakeFiles/makemhr.dir/utils/makemhr/loadsofa.cpp.o CMakeFiles/makemhr.dir/utils/makemhr/makemhr.cpp.o -o makemhr -Wl,-rpath,/usr/local/lib:  -pthread  libsofa-support.a  -pthread libcommon.a  /usr/local/lib/libmysofa.so  /usr/lib/libz.so  -lm && :
ld: error: makemhr:(.eh_frame+0x14cf): internal linker error: wrote incorrect addend value 0x3400 instead of 0x0 for dynamic relocation R_386_32 at offset 0x408417 against symbol __gxx_personality_v0
```

Bisecting shows that this starts appearing after 464531193353584cef7003c11ceffee61a7dc38a ("[ELF] --emit-relocs: adjust offsets of .rel[a].eh_frame relocations").

Reproduction tarball: [openal-soft-repro.tar.gz](https://github.com/llvm/llvm-project/files/10180028/openal-soft-repro.tar.gz)

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