Currently loongarch_elf_relax_section may invoke loongarch_relax_delete_bytes O(n) times, and loongarch_relax_delete_bytes just invokes memmove which is O(n) too. Thus we have a quadratic behavior.
Note that a simple "mark and sweep" will make offsets wrong and generate wrong code (that's why we moved away from R_LARCH_DELETE). We need a balanced binary tree to maintain the offset change efficiently.
Currently loongarch_elf_relax_section may invoke loongarch_relax_delete_bytes O(n) times, and loongarch_relax_delete_bytes just invokes memmove which is O(n) too. Thus we have a quadratic behavior.
Note that a simple "mark and sweep" will make offsets wrong and generate wrong code (that's why we moved away from R_LARCH_DELETE). We need
a balanced binary treeto maintain the offset change efficiently.