On 6/12/23 11:09, Xiaotian Wu wrote:
在 2023-06-12星期一的 06:35 +0800,Xi Ruoyao via Grub-devel写道:
On Wed, 2023-06-07 at 15:34 +0800, Xiaotian Wu wrote:
Because the binutils of the loongarch architecture adds relaxation
support [1], the next version of binutils will not be able to build
grub.
So we added the R_LARCH_B16, R_LARCH_B21 and R_LARCH_RELAX
relocations
to enhance grub compatibility.
Wouldn't it be easier to just pass -mno-relax to the toolchain when
we
build GRUB? I don't think it makes too much sense to perform
relaxation
on a boot loader. The boot loader is generally the coldest code
paths
in a system, so relaxing it won't give any real benefit (well, if you
reboot a system 100 times you may finally save one second), but
increases the maintenance burden.
Yes, it's easy to pass -mno-relax, but binutils-2.40 doesn't support
this option.
Then maybe probe it in grub's configure and add it to CFLAGS when it's
supported? IIUC every toolchain with support for relaxation should
provide this toggle, and we already probe several LoongArch-specific
flags right now so the infra is already there.
Consider a new relaxation pattern is added after we release GRUB
2.12.
Then if we simply pass -mno-relax, GRUB 2.12 will continue to work.
But
if we try to "support" relaxation this way, every distro will have to
patch GRUB 2.12 when the toolchain is updated.
GRUB 2.12 has not been released yet. If this patch can be merged before
the release of grub 2.12, every distribution does not need to be
patched. Moreover, both binutils-2.40 and future binutils 2.41+ will be
able to compile normally.
Consider a possible scenario where more relaxation patterns are
implemented by future toolchains; I don't think grub should care, or get
changed every single time when that happens.
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel