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

    <tr>
        <th>Summary</th>
        <td>
            reorder of a orphaned Relro section causes crash on powerpc32 binary
        </td>
    </tr>

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

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

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

<pre>
    FreeBSD powerpc/powerpc64 on PSERIES machines uses a 32 bit loader and it's crashing during boot when built with llvm14.
Bisect points to change https://reviews.llvm.org/D111717.
I noticed that after this change the special section ".data.rel.ro" is placed after ".data"

Good:
```
Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        02c00060 000060 043610 00  AX  0   0 16
  [ 2] .rodata           PROGBITS        02c43670 043670 003ec0 00   A  0   0  4
  [ 3] .rodata.str1.1    PROGBITS        02c47530 047530 0055e6 01 AMS  0   0  1
  [ 4] set_Xcommand_set  PROGBITS        02c4cb18 04cb18 000068 00   A  0   0  4
  [ 5] .eh_frame_hdr     PROGBITS        02c4cb80 04cb80 00001c 00   A  0   0  4
  [ 6] .eh_frame         PROGBITS        02c4cb9c 04cb9c 000040 00   A  0   0  4
  [ 7] .data.rel.ro      PROGBITS        02c4cbdc 04cbdc 000678 00  WA  0   0  4
  [ 8] .data             PROGBITS        02c4e000 04e000 005d40 00  WA  0   0 16
  [ 9] .bss              NOBITS          02c53d40 053d40 8016dc 00  WA  0   0  8
```

Bad:
```
Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        02c00060 000060 043610 00  AX  0   0 16
  [ 2] .rodata           PROGBITS        02c43670 043670 003ec0 00   A  0   0  4
  [ 3] .rodata.str1.1    PROGBITS        02c47530 047530 0055e6 01 AMS  0   0  1
  [ 4] set_Xcommand_set  PROGBITS        02c4cb18 04cb18 000068 00   A  0   0  4
  [ 5] .eh_frame_hdr     PROGBITS        02c4cb80 04cb80 00001c 00   A  0   0  4
  [ 6] .eh_frame         PROGBITS        02c4cb9c 04cb9c 000040 00   A  0   0  4
  [ 7] .data             PROGBITS        02c4d000 04d000 005d40 00  WA  0   0 16
  [ 8] .data.rel.ro      PROGBITS        02c52d40 052d40 000678 00  WA  0   0  4
  [ 9] .bss              NOBITS          02c533b8 0533b8 8016dc 00  WA  0   0  8
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztlk1z0zAQhn-NfdnBI_krzsGHdEKhM6VlGhi4dWRpEwscKyMpLeXXI8lucKCk5V6N49WH_Wi9We28jRIP9blGPFstYafuUe94lJ6PvTIH1cPH1dubi7cr2DLeyh4N7I27MchSaKSFTjGBGlgvQNoonRngmhn35AbEXnvTKGXhvsUemr3sXFfaFrrubkvzJCLLiCzOpEFunQOytwasAt6yfoPQWrszUbZwLrlL453Ee5P4VxOlN25qSSmd0dmIuYBeWclRgG2ZBba2zjHbSvPIsy2C2SGXrAO_o3SfF6VpIphlicYu0coNwb2w65jnDIjHR5wdNhru75QS3rlhqiTjFYarkf4efXTM4TGAqDi70lGxhCu2RThqnx52RzMLIXToXK_X3qzkT7_u_ovzbgOX3-GiX8Oim5CBePLf7erz5eV0TMYGf5pxefiRKZl6cmLxhz0if7y5fnd28Wl1IKfckcoB6U2elXQgL74-kmk5JaeBrJUP8WmyY80GpDckQz76vDj4nE_J2YScGKtpQv9FnhWZJw-GFAWWQCgsPqwOZDol555s0N5-5Wq7dcl_6wZPk3lDK0cejA9KddLnIviM7e1auwS5bccUeJpckUCuhnBTfpJcHpFPxpk3cx7I3riWn47zLJAnp-gUWQxkEcjlbIjGl3-QqwP5uazLMWTwaEghRp9_k4-zbh7IjTFHYLi6nnIDucgCazAVoaXgf_pcPVkExuLGXqvEa5V4rRKTKvFcbuRiOMvihWe5enH9KdLhLA_m-frzP1UiaypfJbx5WZWIRZ2JeTZnsZW2w1qj0l5LqbWTV0rvnGhxGuQGO_dBj3KFsyC_gsby6myUakGM9Uw_xHvd1ce6aeP01r5JXAq6gRdPo3mz0-qbw7qhNGaPxnWKMiNl3NZZnjVp2dAU5xwx4zPMM5KJimfz-ZrkLO5Yg52pXYycKurxHgLCK6RiGcs6JWlKHIumOSlIUrKGU1xjXlCcVw1GOcEtk91By8W6Di41-41xi5009rfQi5kxctMjhu0cn-1tq3TNBOvYHYvD1nVw_RfgB7K1">