On Mon, 2023-06-12 at 14:54 +0800, WANG Xuerui wrote: > 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.
--no-relax is accepted even with ld-2.38, the man page says: On platforms where the feature is not supported, both --relax and --no-relax are accepted, but ignored. And it *should* disable relax for ld-2.41. If not I'd consider it a bug and we should fix it for Binutils. If --no-relax behaves as expected I guess we just need LDFLAGS_PLATFORM += -Wl,--no-relax in "if test "x$target_cpu" = xloongarch64" block. -- Xi Ruoyao <xry...@xry111.site> School of Aerospace Science and Technology, Xidian University _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel