diff --git a/port-Add-LoongArch-support.patch b/1000-port-Add-LoongArch-support.patch similarity index 100% rename from port-Add-LoongArch-support.patch rename to 1000-port-Add-LoongArch-support.patch diff --git a/loongarch-Modify-the-location-where-initrd-is-loaded.patch b/1001-loongarch-Modify-the-location-where-initrd-is-loaded.patch similarity index 100% rename from loongarch-Modify-the-location-where-initrd-is-loaded.patch rename to 1001-loongarch-Modify-the-location-where-initrd-is-loaded.patch diff --git a/loongarch-Add-EFI-frame-buffer-support.patch b/1002-loongarch-Add-EFI-frame-buffer-support.patch similarity index 100% rename from loongarch-Add-EFI-frame-buffer-support.patch rename to 1002-loongarch-Add-EFI-frame-buffer-support.patch diff --git a/loongarch-Add-support-for-v4.0-interface.patch b/1003-loongarch-Add-support-for-v4.0-interface.patch similarity index 100% rename from loongarch-Add-support-for-v4.0-interface.patch rename to 1003-loongarch-Add-support-for-v4.0-interface.patch diff --git a/loongarch-Add-support-for-new-EFI-screen-info-GUID.patch b/1004-loongarch-Add-support-for-new-EFI-screen-info-GUID.patch similarity index 100% rename from loongarch-Add-support-for-new-EFI-screen-info-GUID.patch rename to 1004-loongarch-Add-support-for-new-EFI-screen-info-GUID.patch diff --git a/loongarch-Force-initrd-load-address-64KiB-alignment.patch b/1005-loongarch-Force-initrd-load-address-64KiB-alignment.patch similarity index 100% rename from loongarch-Force-initrd-load-address-64KiB-alignment.patch rename to 1005-loongarch-Force-initrd-load-address-64KiB-alignment.patch diff --git a/loongarch-Implement-cache-synchronization-operation.patch b/1006-loongarch-Implement-cache-synchronization-operation.patch similarity index 100% rename from loongarch-Implement-cache-synchronization-operation.patch rename to 1006-loongarch-Implement-cache-synchronization-operation.patch diff --git a/loongarch-Fix-the-initrd-parameter-passing.patch b/1007-loongarch-Fix-the-initrd-parameter-passing.patch similarity index 100% rename from loongarch-Fix-the-initrd-parameter-passing.patch rename to 1007-loongarch-Fix-the-initrd-parameter-passing.patch diff --git a/1008-loongarch-Disable-relaxation-relocations.patch b/1008-loongarch-Disable-relaxation-relocations.patch new file mode 100644 index 0000000000000000000000000000000000000000..0ee70f9b7f310c4d7022ef915282c6f7e40d9e3c --- /dev/null +++ b/1008-loongarch-Disable-relaxation-relocations.patch @@ -0,0 +1,64 @@ +From 115c628cc44f89207858d0c79e970e43da75c772 Mon Sep 17 00:00:00 2001 +From: Yingkun Meng +Date: Tue, 5 Dec 2023 19:22:14 +0800 +Subject: [PATCH] loongarch: Disable relaxation relocations + +commit 87247635c0d583cfbc1947107d23b40877d107b8 upstream. + +A working GRUB cannot be built with upcoming binutils and GCC, because linker +relaxation was added [1] causing new unsupported relocations to appear in modules. + +So we pass -mno-relax to GCC if it is supported, to disable relaxation and make +GRUB forward-compatible with new toolchains. + +While similar code already exists for sparc64 in configure.ac, sparc64 sets +LDFLAGS while LoongArch requires CFLAGS to be set. If we only set LDFLAGS on +LoongArch, GCC will still generate relaxation relocations in the .o files, so +the sparc64 code cannot be reused. + +[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=56576f4a722b7398d35802ecf7d4185c27d6d69b + +Signed-off-by: Xiaotian Wu +Signed-off-by: Yingkun Meng +Change-Id: I09ef306dc8a0f8a59e9b7dbc53ae3fd3cc09ec55 +--- + configure.ac | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 0db9d7d111b8..e010bc0db465 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -908,6 +908,29 @@ if test "x$target_cpu" = xloongarch64; then + TARGET_CFLAGS="$TARGET_CFLAGS -mno-explicit-relocs -fno-plt" + TARGET_CCASFLAGS="$TARGET_CCASFLAGS -mno-explicit-relocs -fno-plt" + fi ++ ++ AC_CACHE_CHECK([for no-relax options], grub_cv_target_cc_mno_relax, [ ++ grub_cv_target_cc_mno_relax=no ++ for cand in "-mno-relax" "-Wa,-mno-relax"; do ++ if test x"$grub_cv_target_cc_mno_relax" != xno ; then ++ break ++ fi ++ CFLAGS="$TARGET_CFLAGS $cand -Werror" ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ asm (".globl start; start:"); ++ void __main (void); ++ void __main (void) {} ++ int main (void); ++ ]], [[]])], [grub_cv_target_cc_mno_relax="$cand"], []) ++ done ++ ]) ++ CFLAGS="$TARGET_CFLAGS" ++ ++ if test x"$grub_cv_target_cc_mno_relax" != xno ; then ++ TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mno_relax" ++ TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_mno_relax" ++ fi ++ + TARGET_CFLAGS="$TARGET_CFLAGS -Wa,-mla-global-with-abs" + TARGET_CCASFLAGS="$TARGET_CCASFLAGS -Wa,-mla-global-with-abs" + fi +-- +2.33.0 + diff --git a/grub.patches b/grub.patches index 8eeec100192f4daea692d6338c7570537bd8880b..ff56cbc5bb714a6f66ba76d7a6e7d72081e02002 100644 --- a/grub.patches +++ b/grub.patches @@ -286,13 +286,9 @@ Patch0286: backport-font-Fix-an-integer-underflow-in-blit_comb.patch Patch0287: backport-font-Harden-grub_font_blit_glyph-and-grub_font_blit_.patch Patch0288: backport-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch Patch0289: backport-normal-charset-Fix-an-integer-overflow-in-grub_unico.patch -%ifarch loongarch64 -Patch0290: port-Add-LoongArch-support.patch -%endif +Patch0290: 1000-port-Add-LoongArch-support.patch Patch0291: disable-some-unsupported-filesystems.patch -%ifarch loongarch64 -Patch0292: loongarch-Modify-the-location-where-initrd-is-loaded.patch -%endif +Patch0292: 1001-loongarch-Modify-the-location-where-initrd-is-loaded.patch Patch0293: backport-disk-diskfilter-Check-calloc-result-for-NULL.patch Patch0294: backport-kern-buffer-Handle-NULL-input-pointer-in-grub_buffer.patch Patch0295: backport-disk-diskfilter-Don-t-make-a-RAID-array-with-more-th.patch @@ -304,16 +300,12 @@ Patch0300: backport-kern-file-Fix-error-handling-in-grub_file_open.patch Patch0301: backport-fs-xfs-Fix-memory-leaks-in-XFS-module.patch Patch0302: backport-fs-squash4-Fix-memory-leaks-in-grub_squash_iterate_d.patch Patch0303: backport-fs-iso9660-Fix-memory-leaks-in-grub_iso9660_susp_ite.patch -%ifarch loongarch64 -Patch0304: loongarch-Add-EFI-frame-buffer-support.patch -Patch0305: loongarch-Add-support-for-v4.0-interface.patch -Patch0306: loongarch-Add-support-for-new-EFI-screen-info-GUID.patch -%endif +Patch0304: 1002-loongarch-Add-EFI-frame-buffer-support.patch +Patch0305: 1003-loongarch-Add-support-for-v4.0-interface.patch +Patch0306: 1004-loongarch-Add-support-for-new-EFI-screen-info-GUID.patch Patch0307: 0202-rpm-sort-add-prereqs-for-declaration-of-strchrnul.patch -%ifarch loongarch64 -Patch0308: loongarch-Force-initrd-load-address-64KiB-alignment.patch -Patch0309: loongarch-Implement-cache-synchronization-operation.patch -%endif +Patch0308: 1005-loongarch-Force-initrd-load-address-64KiB-alignment.patch +Patch0309: 1006-loongarch-Implement-cache-synchronization-operation.patch Patch0310: backport-font-Check-return-value-of-grub_malloc-in-ascii_glyph_lookup.patch Patch0311: backport-font-Assign-null_font-to-unknown_glyph.patch Patch0312: backport-font-Reject-fonts-with-negative-max_char_width-or-max_char_height.patch @@ -331,9 +323,7 @@ Patch0323: Revert-EFI-allocate-kernel-in-EFI_RUNTIME_SERVICES_C.patch Patch0324: backport-commands-acpi-Use-xsdt_addr-if-present.patch Patch0325: backport-kern-acpi-Use-xsdt_addr-if-present.patch Patch0326: remove-the-items-of-unsupported-filesystems-in-fs.ls.patch -%ifarch loongarch64 -Patch0327: loongarch-Fix-the-initrd-parameter-passing.patch -%endif +Patch0327: 1007-loongarch-Fix-the-initrd-parameter-passing.patch Patch0328: backport-net-dns-Fix-removal-of-DNS-server.patch Patch0329: backport-net-dns-Simplify-error-handling-of-recv_hook-function.patch Patch0330: backport-net-dns-Fix-lookup-error-when-no-IPv6-is-returned.patch @@ -344,3 +334,4 @@ Patch0334: backport-RISC-V-Handle-R_RISCV_CALL_PLT-reloc.patch Patch0335: backport-fs-udf-Fix-out-of-bounds-access.patch Patch0336: backport-lib-relocator-Fix-OOB-write-when-initializing-lo-freebytes.patch Patch0337: backport-util-grub-mount-Fix-memory-leak-in-fuse_getattr.patch +Patch0338: 1008-loongarch-Disable-relaxation-relocations.patch diff --git a/grub2.spec b/grub2.spec index dd6361bca88a84d80d658adbbb3eba5ded73366a..0c6d781b29359d3711d360a8adb39b0c17033c75 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 37 +Release: 38 Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -440,6 +440,12 @@ fi %{_datadir}/man/man* %changelog +* Tue Dec 5 2023 mengyingkun - 1:2.06-38 +- Type:requirement +- CVE:NA +- SUG:NA +- DESC:loongarch: Disable relaxation relocations + * Wed Sep 13 2023 zhangqiumiao - 1:2.06-37 - Type:bugfix - CVE:NA