[v1,0/6] Fix some bugs of relaxation

Message ID 20231116062307.3292483-1-mengqinggang@loongson.cn
Headers
Series Fix some bugs of relaxation |

Message

mengqinggang Nov. 16, 2023, 6:23 a.m. UTC
  These patches mainly fix the shared objects can't be relaxed bug.
The "elf_seg_map (info->output_bfd) == NULL" condition prevent the
shared object to be relaxed. Ld can perform up to 10 relaxation tries.
In first try, both execute file and shared object do not meet this condition.
But the execute file can trigger a second try because of the program header
size change due to the number of segement change (execute file add 
extra INTERP segemnt).

mengqinggang (6):
  LoongArch: Fix ld --no-relax bug
  LoongArch: Directly delete relaxed instuctions in first relaxation
    pass
  LoongArch: Multiple relax_trip in one relax_pass
  LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation
    condition
  LoongArch: Modify link_info.relax_pass from 3 to 2
  LoongArch: Add more relaxation testcases

 bfd/elfnn-loongarch.c                         | 53 +++++++-----
 ld/emultempl/loongarchelf.em                  | 20 ++++-
 .../ld-loongarch-elf/relax-segment-max.s      | 13 +++
 .../ld-loongarch-elf/relax-segment-min.s      | 13 +++
 ld/testsuite/ld-loongarch-elf/relax-so.s      |  4 +
 ld/testsuite/ld-loongarch-elf/relax.exp       | 80 +++++++++++++++++--
 6 files changed, 158 insertions(+), 25 deletions(-)
 create mode 100644 ld/testsuite/ld-loongarch-elf/relax-segment-max.s
 create mode 100644 ld/testsuite/ld-loongarch-elf/relax-segment-min.s
 create mode 100644 ld/testsuite/ld-loongarch-elf/relax-so.s