summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/ovmf/ovmf/0001-BaseTools-header.makefile-add-Wno-stringop-truncatio.patch
diff options
context:
space:
mode:
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.patch71
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 @@
1From 9fce4bab014b9aa618060eba13d6dd04b0fa1b70 Mon Sep 17 00:00:00 2001
2From: Laszlo Ersek <lersek@redhat.com>
3Date: Fri, 2 Mar 2018 17:11:52 +0100
4Subject: [PATCH 1/4] BaseTools/header.makefile: add "-Wno-stringop-truncation"
5
6gcc-8 (which is part of Fedora 28) enables the new warning
7"-Wstringop-truncation" in "-Wall". This warning is documented in detail
8at <https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html>; the
9introduction 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
15It 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
34The right way to fix the warning would be to implement string concat with
35snprintf(). However, Microsoft does not appear to support snprintf()
36before VS2015
37<https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010>,
38so we just have to shut up the warning. The strncat() calls flagged above
39are valid BTW.
40
41Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
42Cc: Cole Robinson <crobinso@redhat.com>
43Cc: Liming Gao <liming.gao@intel.com>
44Cc: Paolo Bonzini <pbonzini@redhat.com>
45Cc: Yonghong Zhu <yonghong.zhu@intel.com>
46Contributed-under: TianoCore Contribution Agreement 1.1
47Signed-off-by: Laszlo Ersek <lersek@redhat.com>
48Reviewed-by: Liming Gao <liming.gao@intel.com>
49---
50Signed-off-by: Khem Raj <raj.khem@gmail.com>
51Upstream-Status: Backport
52
53 BaseTools/Source/C/Makefiles/header.makefile | 4 ++--
54 1 file changed, 2 insertions(+), 2 deletions(-)
55
56Index: 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