diff options
author | Khem Raj <raj.khem@gmail.com> | 2022-09-16 12:05:47 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-09-20 23:17:53 +0100 |
commit | dab9e569c6a89685d0a0afcca7630cb609212881 (patch) | |
tree | f82ab0c2056cbe720d3314d48d9f7ea567f2a84d /meta/recipes-bsp | |
parent | 3acd3c8675f780fd7250776b3e56c1c0b5fa7328 (diff) | |
download | poky-dab9e569c6a89685d0a0afcca7630cb609212881.tar.gz |
grub: Apply backports to fix build with clang on x86
(From OE-Core rev: 2213b6ce1ec944228d7bb3c95f2e02ac0995b5be)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-bsp')
3 files changed, 109 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0001-configure-Remove-obsoleted-malign-jumps-loops-functi.patch b/meta/recipes-bsp/grub/files/0001-configure-Remove-obsoleted-malign-jumps-loops-functi.patch new file mode 100644 index 0000000000..98142a7b60 --- /dev/null +++ b/meta/recipes-bsp/grub/files/0001-configure-Remove-obsoleted-malign-jumps-loops-functi.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From eb486898dac8cbc29b2cc39f911b657c3417ae34 Mon Sep 17 00:00:00 2001 | ||
2 | From: Fangrui Song via Grub-devel <grub-devel@gnu.org> | ||
3 | Date: Thu, 26 Aug 2021 09:02:31 -0700 | ||
4 | Subject: [PATCH 1/2] configure: Remove obsoleted -malign-{jumps, loops, | ||
5 | functions} | ||
6 | MIME-Version: 1.0 | ||
7 | Content-Type: text/plain; charset=UTF-8 | ||
8 | Content-Transfer-Encoding: 8bit | ||
9 | |||
10 | The GCC warns "cc1: warning: ‘-malign-loops’ is obsolete, use ‘-falign-loops’". | ||
11 | The Clang silently ignores -malign-{jumps,loops,functions}. | ||
12 | |||
13 | The preferred -falign-* forms have been supported since GCC 3.2. So, just | ||
14 | remove -malign-{jumps,loops,functions}. | ||
15 | |||
16 | Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=eb486898dac8cbc29b2cc39f911b657c3417ae34] | ||
17 | Signed-off-by: Fangrui Song <maskray@google.com> | ||
18 | Acked-by: Paul Menzel <pmenzel@molgen.mpg.de> | ||
19 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
20 | --- | ||
21 | configure.ac | 9 --------- | ||
22 | 1 file changed, 9 deletions(-) | ||
23 | |||
24 | diff --git a/configure.ac b/configure.ac | ||
25 | index bee28dbeb..9a12151bd 100644 | ||
26 | --- a/configure.ac | ||
27 | +++ b/configure.ac | ||
28 | @@ -805,17 +805,8 @@ if test "x$target_cpu" = xi386; then | ||
29 | [grub_cv_cc_falign_loop=no]) | ||
30 | ]) | ||
31 | |||
32 | - AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [ | ||
33 | - CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror" | ||
34 | - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | ||
35 | - [grub_cv_cc_malign_loop=yes], | ||
36 | - [grub_cv_cc_malign_loop=no]) | ||
37 | - ]) | ||
38 | - | ||
39 | if test "x$grub_cv_cc_falign_loop" = xyes; then | ||
40 | TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" | ||
41 | - elif test "x$grub_cv_cc_malign_loop" = xyes; then | ||
42 | - TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" | ||
43 | fi | ||
44 | fi | ||
45 | |||
46 | -- | ||
47 | 2.37.3 | ||
48 | |||
diff --git a/meta/recipes-bsp/grub/files/0002-configure-Check-for-falign-jumps-1-beside-falign-loo.patch b/meta/recipes-bsp/grub/files/0002-configure-Check-for-falign-jumps-1-beside-falign-loo.patch new file mode 100644 index 0000000000..437e5b29b2 --- /dev/null +++ b/meta/recipes-bsp/grub/files/0002-configure-Check-for-falign-jumps-1-beside-falign-loo.patch | |||
@@ -0,0 +1,59 @@ | |||
1 | From e372dcb0d4541ee9b9682cde088ec87a7b238ca2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Fangrui Song via Grub-devel <grub-devel@gnu.org> | ||
3 | Date: Thu, 26 Aug 2021 09:02:32 -0700 | ||
4 | Subject: [PATCH 2/2] configure: Check for -falign-jumps=1 beside | ||
5 | -falign-loops=1 | ||
6 | |||
7 | The Clang does not support -falign-jumps and only recently gained support | ||
8 | for -falign-loops. The -falign-jumps=1 should be tested beside | ||
9 | -fliang-loops=1 to avoid passing unrecognized options to the Clang: | ||
10 | |||
11 | clang-14: error: optimization flag '-falign-jumps=1' is not supported [-Werror,-Wignored-optimization-argument] | ||
12 | |||
13 | The -falign-functions=1 is supported by GCC 5.1.0/Clang 3.8.0. So, just | ||
14 | add the option unconditionally. | ||
15 | |||
16 | Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=e372dcb0d4541ee9b9682cde088ec87a7b238ca2] | ||
17 | Signed-off-by: Fangrui Song <maskray@google.com> | ||
18 | Acked-by: Paul Menzel <pmenzel@molgen.mpg.de> | ||
19 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
20 | --- | ||
21 | configure.ac | 15 ++++++++++++++- | ||
22 | 1 file changed, 14 insertions(+), 1 deletion(-) | ||
23 | |||
24 | diff --git a/configure.ac b/configure.ac | ||
25 | index 9a12151bd..eeb5d2211 100644 | ||
26 | --- a/configure.ac | ||
27 | +++ b/configure.ac | ||
28 | @@ -798,6 +798,8 @@ fi | ||
29 | |||
30 | # Force no alignment to save space on i386. | ||
31 | if test "x$target_cpu" = xi386; then | ||
32 | + TARGET_CFLAGS="$TARGET_CFLAGS -falign-functions=1" | ||
33 | + | ||
34 | AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ | ||
35 | CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror" | ||
36 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | ||
37 | @@ -806,7 +808,18 @@ if test "x$target_cpu" = xi386; then | ||
38 | ]) | ||
39 | |||
40 | if test "x$grub_cv_cc_falign_loop" = xyes; then | ||
41 | - TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" | ||
42 | + TARGET_CFLAGS="$TARGET_CFLAGS -falign-loops=1" | ||
43 | + fi | ||
44 | + | ||
45 | + AC_CACHE_CHECK([whether -falign-jumps works], [grub_cv_cc_falign_jumps], [ | ||
46 | + CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -Werror" | ||
47 | + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], | ||
48 | + [grub_cv_cc_falign_jumps=yes], | ||
49 | + [grub_cv_cc_falign_jumps=no]) | ||
50 | + ]) | ||
51 | + | ||
52 | + if test "x$grub_cv_cc_falign_jumps" = xyes; then | ||
53 | + TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1" | ||
54 | fi | ||
55 | fi | ||
56 | |||
57 | -- | ||
58 | 2.37.3 | ||
59 | |||
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc index 47ea561002..4a4bd571f5 100644 --- a/meta/recipes-bsp/grub/grub2.inc +++ b/meta/recipes-bsp/grub/grub2.inc | |||
@@ -32,6 +32,8 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \ | |||
32 | file://CVE-2022-28734-net-http-Fix-OOB-write-for-split-http-headers.patch \ | 32 | file://CVE-2022-28734-net-http-Fix-OOB-write-for-split-http-headers.patch \ |
33 | file://CVE-2022-28734-net-http-Error-out-on-headers-with-LF-without-CR.patch \ | 33 | file://CVE-2022-28734-net-http-Error-out-on-headers-with-LF-without-CR.patch \ |
34 | file://CVE-2022-28735-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch \ | 34 | file://CVE-2022-28735-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch \ |
35 | file://0001-configure-Remove-obsoleted-malign-jumps-loops-functi.patch \ | ||
36 | file://0002-configure-Check-for-falign-jumps-1-beside-falign-loo.patch \ | ||
35 | " | 37 | " |
36 | 38 | ||
37 | SRC_URI[sha256sum] = "23b64b4c741569f9426ed2e3d0e6780796fca081bee4c99f62aa3f53ae803f5f" | 39 | SRC_URI[sha256sum] = "23b64b4c741569f9426ed2e3d0e6780796fca081bee4c99f62aa3f53ae803f5f" |