diff options
Diffstat (limited to 'meta/recipes-core/ovmf/ovmf/0002-BaseTools-header.makefile-add-Wno-restrict.patch')
-rw-r--r-- | meta/recipes-core/ovmf/ovmf/0002-BaseTools-header.makefile-add-Wno-restrict.patch | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/meta/recipes-core/ovmf/ovmf/0002-BaseTools-header.makefile-add-Wno-restrict.patch b/meta/recipes-core/ovmf/ovmf/0002-BaseTools-header.makefile-add-Wno-restrict.patch deleted file mode 100644 index a076665c33..0000000000 --- a/meta/recipes-core/ovmf/ovmf/0002-BaseTools-header.makefile-add-Wno-restrict.patch +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | From 86dbdac5a25bd23deb4a0e0a97b527407e02184d Mon Sep 17 00:00:00 2001 | ||
2 | From: Laszlo Ersek <lersek@redhat.com> | ||
3 | Date: Fri, 2 Mar 2018 17:11:52 +0100 | ||
4 | Subject: [PATCH 2/4] BaseTools/header.makefile: add "-Wno-restrict" | ||
5 | |||
6 | gcc-8 (which is part of Fedora 28) enables the new warning | ||
7 | "-Wrestrict" in "-Wall". This warning is documented in detail | ||
8 | at <https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html>; the | ||
9 | introduction says | ||
10 | |||
11 | > Warn when an object referenced by a restrict-qualified parameter (or, in | ||
12 | > C++, a __restrict-qualified parameter) is aliased by another argument, | ||
13 | > or when copies between such objects overlap. | ||
14 | |||
15 | It breaks the BaseTools build (in the Brotli compression library) with: | ||
16 | |||
17 | > In function 'ProcessCommandsInternal', | ||
18 | > inlined from 'ProcessCommands' at dec/decode.c:1828:10: | ||
19 | > dec/decode.c:1781:9: error: 'memcpy' accessing between 17 and 2147483631 | ||
20 | > bytes at offsets 16 and 16 overlaps between 17 and 2147483631 bytes at | ||
21 | > offset 16 [-Werror=restrict] | ||
22 | > memcpy(copy_dst + 16, copy_src + 16, (size_t)(i - 16)); | ||
23 | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
24 | > In function 'ProcessCommandsInternal', | ||
25 | > inlined from 'SafeProcessCommands' at dec/decode.c:1833:10: | ||
26 | > dec/decode.c:1781:9: error: 'memcpy' accessing between 17 and 2147483631 | ||
27 | > bytes at offsets 16 and 16 overlaps between 17 and 2147483631 bytes at | ||
28 | > offset 16 [-Werror=restrict] | ||
29 | > memcpy(copy_dst + 16, copy_src + 16, (size_t)(i - 16)); | ||
30 | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
31 | |||
32 | Paolo Bonzini <pbonzini@redhat.com> analyzed the Brotli source in detail, | ||
33 | and concluded that the warning is a false positive: | ||
34 | |||
35 | > This seems safe to me, because it's preceded by: | ||
36 | > | ||
37 | > uint8_t* copy_dst = &s->ringbuffer[pos]; | ||
38 | > uint8_t* copy_src = &s->ringbuffer[src_start]; | ||
39 | > int dst_end = pos + i; | ||
40 | > int src_end = src_start + i; | ||
41 | > if (src_end > pos && dst_end > src_start) { | ||
42 | > /* Regions intersect. */ | ||
43 | > goto CommandPostWrapCopy; | ||
44 | > } | ||
45 | > | ||
46 | > If [src_start, src_start + i) and [pos, pos + i) don't intersect, then | ||
47 | > neither do [src_start + 16, src_start + i) and [pos + 16, pos + i). | ||
48 | > | ||
49 | > The if seems okay: | ||
50 | > | ||
51 | > (src_start + i > pos && pos + i > src_start) | ||
52 | > | ||
53 | > which can be rewritten to: | ||
54 | > | ||
55 | > (pos < src_start + i && src_start < pos + i) | ||
56 | > | ||
57 | > Then the numbers are in one of these two orders: | ||
58 | > | ||
59 | > pos <= src_start < pos + i <= src_start + i | ||
60 | > src_start <= pos < src_start + i <= pos + i | ||
61 | > | ||
62 | > These two would be allowed by the "if", but they can only happen if pos | ||
63 | > == src_start so they degenerate to the same two orders above: | ||
64 | > | ||
65 | > pos <= src_start < src_start + i <= pos + i | ||
66 | > src_start <= pos < pos + i <= src_start + i | ||
67 | > | ||
68 | > So it is a false positive in GCC. | ||
69 | |||
70 | Disable the warning for now. | ||
71 | |||
72 | Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> | ||
73 | Cc: Cole Robinson <crobinso@redhat.com> | ||
74 | Cc: Liming Gao <liming.gao@intel.com> | ||
75 | Cc: Paolo Bonzini <pbonzini@redhat.com> | ||
76 | Cc: Yonghong Zhu <yonghong.zhu@intel.com> | ||
77 | Reported-by: Cole Robinson <crobinso@redhat.com> | ||
78 | Contributed-under: TianoCore Contribution Agreement 1.1 | ||
79 | Signed-off-by: Laszlo Ersek <lersek@redhat.com> | ||
80 | Reviewed-by: Liming Gao <liming.gao@intel.com> | ||
81 | --- | ||
82 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
83 | Upstream-Status: Backport | ||
84 | BaseTools/Source/C/Makefiles/header.makefile | 4 ++-- | ||
85 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
86 | |||
87 | Index: git/BaseTools/Source/C/Makefiles/header.makefile | ||
88 | =================================================================== | ||
89 | --- git.orig/BaseTools/Source/C/Makefiles/header.makefile | ||
90 | +++ git/BaseTools/Source/C/Makefiles/header.makefile | ||
91 | @@ -47,9 +47,9 @@ INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) | ||
92 | BUILD_CPPFLAGS += $(INCLUDE) -O2 | ||
93 | ifeq ($(DARWIN),Darwin) | ||
94 | # assume clang or clang compatible flags on OS X | ||
95 | -BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-self-assign -Wno-unused-result -nostdlib -c -g | ||
96 | +BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict -Wno-self-assign -Wno-unused-result -nostdlib -c -g | ||
97 | else | ||
98 | -BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-unused-result -nostdlib -c -g | ||
99 | +BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict -Wno-unused-result -nostdlib -c -g | ||
100 | endif | ||
101 | BUILD_LFLAGS = $(LDFLAGS) | ||
102 | BUILD_CXXFLAGS += -Wno-unused-result | ||