1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
From 2f61f3547e3e854cb1b1a7752e2a5e4d38e07f74 Mon Sep 17 00:00:00 2001
From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Date: Fri, 6 May 2022 03:25:42 +0200
Subject: [PATCH] cbfstool: enable to disable -Werror in standalone builds
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
With GCC 11.2, on GNU/Linux i686, if we run the following commands:
$ cd util/cbfstool
$ make
the build fails with with the following error:
host/lib/extract_vmlinuz.c: In function ‘ExtractVmlinuz’:
host/lib/extract_vmlinuz.c:67:9: warning:
‘memcpy’ specified bound between 2147483648 and 4294967295
exceeds maximum object size 2147483647 [-Wstringop-overflow=]
67 | memcpy(vmlinuz, kpart_data + vmlinuz_header_offset,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | vmlinuz_header_size);
| ~~~~~~~~~~~~~~~~~~~~
Enabling to build cbfstool (and its dependencies like vboot where the
above error comes from), we can enable users and distributions to
build cbfstool with the distribution toolchain.
For that they would need to pass WERROR='' to make, like that:
$ cd util/cbfstool
$ make WERROR=''
Since util/cbfstool/lz4/Makefile isn't used during the build of a
standalone cbfstool or a coreboot image, we can simply ignore the
-Werror that are inside.
Change-Id: I24f59661d3fc218d1e4cd4c36006172ead08b18d
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
---
Description: This patch is needed to fix the cbfstool compilation on
32bit architectures.
Forwarded: https://review.coreboot.org/c/coreboot/+/64131
Author: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
---
util/cbfstool/Makefile | 2 ++
util/cbfstool/Makefile.inc | 5 ++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/util/cbfstool/Makefile b/util/cbfstool/Makefile
index 034aca26a6be..6fc8cdf1635c 100644
--- a/util/cbfstool/Makefile
+++ b/util/cbfstool/Makefile
@@ -11,6 +11,8 @@ INSTALL ?= /usr/bin/env install
OBJCOPY ?= objcopy
override objutil := ..
+WERROR ?= -Werror
+
VBOOT_SOURCE ?= $(top)/3rdparty/vboot
VBOOT_HOST_BUILD ?= $(abspath $(objutil)/vboot_lib)
diff --git a/util/cbfstool/Makefile.inc b/util/cbfstool/Makefile.inc
index f3e6c75dced2..d35f734c8b16 100644
--- a/util/cbfstool/Makefile.inc
+++ b/util/cbfstool/Makefile.inc
@@ -1,3 +1,5 @@
+WERROR ?= -Werror
+
compressionobj :=
compressionobj += compress.o
# LZ4
@@ -110,7 +112,7 @@ cse_serger_obj += common.o
cse_serger_obj += cse_helpers.o
cse_serger_obj += $(foreach var, $(bpdt_formats_obj), $(var))
-TOOLCFLAGS ?= -Werror -Wall -Wextra -Wshadow
+TOOLCFLAGS ?= $(WERROR) -Wall -Wextra -Wshadow
TOOLCFLAGS += -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow
TOOLCFLAGS += -Wstrict-prototypes -Wwrite-strings
TOOLCFLAGS += -O2
@@ -156,6 +158,7 @@ $(VBOOT_HOSTLIB):
PKG_CONFIG="true" \
V=$(V) \
DEBUG= \
+ WERROR=$(WERROR) \
hostlib
$(objutil)/cbfstool/%.o: $(objutil)/cbfstool/%.c
--
2.36.0
|