diff options
Diffstat (limited to 'meta/recipes-core/ovmf/ovmf/0001-BaseTools-header.makefile-add-Wno-stringop-truncatio.patch')
-rw-r--r-- | meta/recipes-core/ovmf/ovmf/0001-BaseTools-header.makefile-add-Wno-stringop-truncatio.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/meta/recipes-core/ovmf/ovmf/0001-BaseTools-header.makefile-add-Wno-stringop-truncatio.patch b/meta/recipes-core/ovmf/ovmf/0001-BaseTools-header.makefile-add-Wno-stringop-truncatio.patch new file mode 100644 index 0000000000..342fcc6231 --- /dev/null +++ b/meta/recipes-core/ovmf/ovmf/0001-BaseTools-header.makefile-add-Wno-stringop-truncatio.patch | |||
@@ -0,0 +1,71 @@ | |||
1 | From 9fce4bab014b9aa618060eba13d6dd04b0fa1b70 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 1/4] BaseTools/header.makefile: add "-Wno-stringop-truncation" | ||
5 | |||
6 | gcc-8 (which is part of Fedora 28) enables the new warning | ||
7 | "-Wstringop-truncation" 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 for calls to bounded string manipulation functions such as strncat, | ||
12 | > strncpy, and stpncpy that may either truncate the copied string or leave | ||
13 | > the destination unchanged. | ||
14 | |||
15 | It breaks the BaseTools build with: | ||
16 | |||
17 | > EfiUtilityMsgs.c: In function 'PrintMessage': | ||
18 | > EfiUtilityMsgs.c:484:9: error: 'strncat' output may be truncated copying | ||
19 | > between 0 and 511 bytes from a string of length 511 | ||
20 | > [-Werror=stringop-truncation] | ||
21 | > strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1); | ||
22 | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
23 | > EfiUtilityMsgs.c:469:9: error: 'strncat' output may be truncated copying | ||
24 | > between 0 and 511 bytes from a string of length 511 | ||
25 | > [-Werror=stringop-truncation] | ||
26 | > strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1); | ||
27 | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
28 | > EfiUtilityMsgs.c:511:5: error: 'strncat' output may be truncated copying | ||
29 | > between 0 and 511 bytes from a string of length 511 | ||
30 | > [-Werror=stringop-truncation] | ||
31 | > strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1); | ||
32 | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
33 | |||
34 | The right way to fix the warning would be to implement string concat with | ||
35 | snprintf(). However, Microsoft does not appear to support snprintf() | ||
36 | before VS2015 | ||
37 | <https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010>, | ||
38 | so we just have to shut up the warning. The strncat() calls flagged above | ||
39 | are valid BTW. | ||
40 | |||
41 | Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> | ||
42 | Cc: Cole Robinson <crobinso@redhat.com> | ||
43 | Cc: Liming Gao <liming.gao@intel.com> | ||
44 | Cc: Paolo Bonzini <pbonzini@redhat.com> | ||
45 | Cc: Yonghong Zhu <yonghong.zhu@intel.com> | ||
46 | Contributed-under: TianoCore Contribution Agreement 1.1 | ||
47 | Signed-off-by: Laszlo Ersek <lersek@redhat.com> | ||
48 | Reviewed-by: Liming Gao <liming.gao@intel.com> | ||
49 | --- | ||
50 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
51 | Upstream-Status: Backport | ||
52 | |||
53 | BaseTools/Source/C/Makefiles/header.makefile | 4 ++-- | ||
54 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
55 | |||
56 | Index: git/BaseTools/Source/C/Makefiles/header.makefile | ||
57 | =================================================================== | ||
58 | --- git.orig/BaseTools/Source/C/Makefiles/header.makefile | ||
59 | +++ git/BaseTools/Source/C/Makefiles/header.makefile | ||
60 | @@ -47,9 +47,9 @@ INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) | ||
61 | BUILD_CPPFLAGS += $(INCLUDE) -O2 | ||
62 | ifeq ($(DARWIN),Darwin) | ||
63 | # assume clang or clang compatible flags on OS X | ||
64 | -BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -c -g | ||
65 | +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 | ||
66 | else | ||
67 | -BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-unused-result -nostdlib -c -g | ||
68 | +BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-unused-result -nostdlib -c -g | ||
69 | endif | ||
70 | BUILD_LFLAGS = $(LDFLAGS) | ||
71 | BUILD_CXXFLAGS += -Wno-unused-result | ||