loongson-community / discussions

Cross-community issue tracker & discussions / 跨社区工单追踪 & 讨论场所
7 stars 0 forks source link

[英雄贴] Binutils: Optimize loongarch_elf_relax_section #56

Open xry111 opened 3 weeks ago

xry111 commented 3 weeks ago

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.