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

    <tr>
        <th>Summary</th>
        <td>
            [lld] Revised reallocation behavior for a new target
        </td>
    </tr>

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

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

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

<pre>
    I'm trying to modify the behavior of the symbols reallocation in lld for a new target I develop.

I want the linker to set the symbol value to its index in the (output) section instead of its address.

For example, if I have:
```
  [(.text) add=0, main=163, exit=311]
  [(.data) value=532, result=702]
```

I want the output of the reallocation to be:
```
  [(.text) add=0, main=1, exit=2]
  [(.data) value=0, result=1]
```

(What I need is not to change the actual address, but the references to those symbols)

How can I implement that?

CC @mstorsjo 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykU02PmzAQ_TXmMtrI2IGEA4d2EWquvfQ84Al4a3BkD9nk31dms9tkK7WHSlHQwLx5780HxmiHmagWxVdRNBkuPPpQ-zCgiVnnzbU-CLWbgMPVzgOwh8kbe7wCjwQdjXi2PoA_rnG8Tp13EQKhc75Htn4GO4NzBo4-AMJMr8AYBmI4gKEzOX_aCNkI-eXt_wCvOPNazdn5J4VEGYnv6sMZ3ULpveUIdjZ0SSQpQai9X_i0sFAVROpvAiITmiQyAdCYQDE-sLY-AF1wOjkS6hnsEQ4w4pmEviWIUt5-awiQ-qX2G6bLyoXGCN3IBJ7QzkI3ealTRBfLQjc6z0XRfAIbZEzg1Y_QTaFVggSKi0ugnVQfoE8C_mjWm-33QTwMgD10_-Xkzof6twv54CH_uwOh9j9GTMswExmwEWbPSXE_4jzQagZ7XtC9zy1V7xa-2TxSoLmnmCA8-vixg0JV9zzf_Cv0OMMBbBryRGvbkIVu79Oen0Fs5RTZh_jiITO1NpWuMKM6L3eFLnNVldlYl2pXUW9U3vc96bzX27ygLtdSqd50VZXZWkmlpZIq38t9rjcdbXVV7lQp8xx3JYmtpAmt2zh3njY-DJmNcaG6lNt9kTnsyMX1KJVKN7N-FCq1Pwt1wjx1yxDFVjobOf6uwpbdes3OGVE08J3ONpJ53IiPu_18lNkSXD0yn2LaF9UK1Q6Wx6Xb9H4Sqk00t8fTKfgX6lmodhUXhWpX8b8CAAD__8s3URQ">