[PATCH 1/2] LoongArch: bfd: Remove elf_seg_map condition in loongarch_elf_relax_section
Xi Ruoyao
xry111@xry111.site
Thu Oct 5 11:19:42 GMT 2023
On Thu, 2023-10-05 at 18:09 +0800, Xi Ruoyao via Binutils wrote:
> Hi Jinyang,
>
> Any progress on this? During my attempt trying to balance relaxation
> and scheduling better in GCC I found the elf_seg_map condition is
> preventing relaxation on *every* shared library (when we are linking a
> shared library the elf_seg_map of .text is NULL).
>
> On a modern system most code paths are in shared libraries, so it's
> really bad not to perform the relaxation on them. Esp. now we are
> disabling explicit relocs for relaxation, so if we don't relax shared
> libraries we are likely regressing the overall performance of the
> system.
Phew. It's not only a performance issue. It's actually a *correctness*
issue because the condition also causes R_LARCH_ALIGN skipped, so some
programs depending on code alignment (for e.g. duff-device-like code
using pcaddi for eg) will be broken.
Generally skipping the entire relaxation pass for any section containing
R_LARCH_ALIGN is wrong (as we've discussed in
https://github.com/llvm/llvm-project/pull/67424). Even if we don't
really relax a thing we still *must* process R_LARCH_ALIGN.
> Sorry for disturbing you during the national holiday, feel free to defer
> the reply until the holiday ends!
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
More information about the Binutils
mailing list