grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 0/5] loongarch: add relaxation support


From: mengqinggang
Subject: Re: [PATCH v2 0/5] loongarch: add relaxation support
Date: Tue, 13 Jun 2023 15:28:11 +0800
User-agent: Mozilla/5.0 (X11; Linux mips64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

Just like Xi Ruoyao said, just pass -mno-relax option to gcc.


在 2023/6/13 下午3:22, Xiaotian Wu 写道:
Maybe you can tell me how to add compiler options, thank you.

在 2023-06-13星期二的 14:54 +0800,Xiaotian Wu写道:
在 2023-06-13星期二的 14:33 +0800,mengqinggang写道:
LDFLAGS do not affect relocations generation. If just modify
LDFLAGS,
grub still needs to process relaxation relocations.
According to you, the no-relax test logic of sparc64 is wrong? So we
still need patch #5 in v2?

在 2023/6/13 下午2:22, Xiaotian Wu 写道:
在 2023-06-13星期二的 11:25 +0800,mengqinggang写道:
Is this  patch used to check if ld supports --no-relax option?
It need to pass -mno-relax option to as or gcc to disable
binutils
generate relaxation relocations.

Check "-mno-relax" and "-Wl,--no-relax" in order, if "-mno-relax"
is
valid, then LDFLAGS="$LDFLAGS -mno-relax"; if "-Wl,--no-relax" is
valid, then LDFLAGS="$LDFLAGS -Wl,--no-relax", otherwise report
an
error.

The full code is here:
https://github.com/loongarch64/grub/blob/dev-master/configure.ac#L976-L1000

Using binutils 2.40, the LDFLAGS value displayed in the Makefile
is
as
follows, without "-mno-relax" in it:

TARGET_LDFLAGS =  "-Wl,--no-relax -no-pie -Wl,--build-id=none"

在 2023/6/13 上午10:37, Xiaotian Wu 写道:
New patch is ready:
https://github.com/loongarch64/grub/commits/dev-master

I need your help to confirm that binutils-2.40 and binutils-
dev
code
have the same behavior when using compile options, thanks.

在 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.

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.

[1]:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=56576f4a722b7398d35802ecf7d4185c27d6d69b

v1->v2:
- split patch
- drop cast code

Xiaotian Wu (5):
   Use the correct format specifier for formatted output
   loongarch: Optimize code using pc variable
   loongarch: Rename function names
   loongarch: Add ELF relocation types documentation and
comments
   loongarch: Add relaxation support

  grub-core/kern/arm64/dl_helper.c       |  4 +-
  grub-core/kern/loongarch64/dl.c        | 21 +++++++-
  grub-core/kern/loongarch64/dl_helper.c | 72
++++++++++++++++++++++++-
-
  include/grub/elf.h                     |  3 ++
  include/grub/loongarch64/reloc.h       |  6 ++-
  util/grub-mkimagexx.c                  | 28 ++++++++--
  util/grub-module-verifier.c            |  3 ++
  7 files changed, 124 insertions(+), 13 deletions(-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]