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

    <tr>
        <th>Summary</th>
        <td>
            `ld.lld` does not rename relocation sections with related output section name
        </td>
    </tr>

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

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

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

<pre>
    Sometimes we might want to rename sections in relocatable object files with a linker script.

By convention, a name of relocation section is based on the section which the relocations apply, for example, the relocation section for ".foo" would have the name ".rel[a].foo".

---

Linker Script:
```
SECTIONS {
  .foo : {
    *(.bar)
 }
}
```

Input relocatable object file's section headers:
```
  [Nr] Name              Type            Flg Lk Inf Al
 [ 0]                   NULL                 0   0  0
  [ 1] .foo PROGBITS         AX  0   0  4
  [ 2] .rela.foo         RELA I   8   1  8
...
```

Output relocatable object file's section headers:
`ld.bfd` / `ld.gold`:
```
  [Nr] Name              Type Flg Lk Inf Al
  [ 0]                   NULL                 0   0 0
  [ 1] .bar              PROGBITS         AX  0   0  4
  [ 2] .rela.bar         RELA             I   8   1 8
...
```

`ld.lld`:
```
  [Nr] Name              Type Flg Lk Inf Al
  [ 0]                   NULL                 0   0 0
  [ 1] .bar              PROGBITS         AX  0   0  4
  [ 2] .rela.foo         RELA             I   8   1  8
...
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVUFv8jgQ_TXOZURkOySQQw5QygoJ0VXpSnt1kgnx1okj2ynLv185AQqiXa26t88Cgx_znj1vcEZYKw8tYkbiJYlXgehdrU3malTCOiXbINflKdvrBp1s0MIRoZGH2sFRtA6cBoOtaBAsFk7q1oJswaDShXAiVwg6_wsLB5VUnixdDQKUbN_RgC2M7FxI6IrQxTgvT1Do9gNbr0X4EwgY1HV1EZW6vewF0kIuLJagW3D19QxwrGVRD8gnyYLoOnXympU2gH-LplPol_dxVxEfRTgPK60J53DUvSqhFh84EIZT-Z8NKhIvBYlX58i7fCaTye1yOya-HxIn0RklCT2_huX--elt87LbA5ktRwTAawOJFrcYAOELwudhLgzh6Rkms9VZ9frlXn6cN23Xu-8KRfjMXn2oUZRo7HenBSDxcmdIvIKd9-RuvJ26O2StDrB9h01bwUJdDhwvgXr649j9sd0-gHR8324PzPMHj35_ffltuXnbX8MXf14p01sKHygGlRh4l_H6vF3ABgDmAMAA5iMnDMN_MfOld__DTVWGeVWShALhaxiBg1Ye-bnpXzn9Q6u_cDoX5j7yJ7bfigy2347PEvynCoyuqV_ftIf_6temfe9aUGZRmUapCDBjSZqwOOJJEtRZGc9Fiog5Q5ZgNCuwilgUz9i0mOOc8kBmnPKIUcpoOmU0CeesSmKRlkUSV4zhjEwpNkKqUKmPJtTmEEhre8ySWcpooESOyg59hnNfKe7TCkzmoyd5f7BkSpW0zn7ynXQKs9viQqnRQqvdpe88PrnPbcbb5XxvGC_n5QJ6UtAbldXOdcM95GvC1wfp6j4PC90Qvvb7nz8mndH-JhO-HpKxhK-HfP4JAAD__7AE7FA">