Merge ~paelzer/ubuntu/+source/qemu:lp-1988710-qemu-7.0-FTBFS-KINETIC into ubuntu/+source/qemu:ubuntu/kinetic-devel

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: f1d7d62fe0937223e3fe30fc8d69c8a11c76130f
Proposed branch: ~paelzer/ubuntu/+source/qemu:lp-1988710-qemu-7.0-FTBFS-KINETIC
Merge into: ubuntu/+source/qemu:ubuntu/kinetic-devel
Diff against target: 158 lines (+111/-1)
5 files modified
debian/changelog (+16/-0)
debian/patches/series (+2/-0)
debian/patches/ubuntu/lp1988710-opensbi-Makefile-fix-build-with-binutils-2.38.patch (+62/-0)
debian/patches/ubuntu/lp1988710-silence-openbios-array-bounds-false-positive.patch (+23/-0)
debian/rules (+8/-1)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Paride Legovini (community) Approve
Canonical Server Reporter Pending
Review via email: mp+430100@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paride Legovini (paride) wrote :

Looks like this fixed the ftbfs described in LP: #1988710, and formally this MP is all good, but qemu still failed to build in the ppa (amd64):

/<<PKGBUILDDIR>>/roms/opensbi/lib/sbi/sbi_tlb.c: Assembler messages:
/<<PKGBUILDDIR>>/roms/opensbi/lib/sbi/sbi_tlb.c:190: Error: unrecognized opcode `fence.i', extension `zifencei' required
make[3]: *** [Makefile:431: /<<PKGBUILDDIR>>/b/opensbi/lib/sbi/sbi_tlb.o] Error 1

review: Needs Fixing
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Added a fix for that as well, restarted PPA builds

Revision history for this message
Paride Legovini (paride) wrote :

LGTM:

- The LTO and array-bounds fixes are the same I proposed in [1], so I'm clearly +1 for those.
- The OPT=-O1 workaround works fine. The only worry I have is that it's likely that when the GCC crash gets fixed we won't realize, and that -O1 will stay there. However given which code that optimization affects I don't think this is a big issue.
- The binutils related fix comes from opensbi upstream. The commit message shows that it has been tested on a Debian-like system (likely Ubuntu as the patch is Tested-by a Canonical person).
- All the PPA builds are good.
- All the MP formal aspects are good.

Thanks!

[1] https://code.launchpad.net/~paride/ubuntu/+source/qemu/+git/qemu/+merge/429375

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: paelzer, paride
Uploaders: paelzer, paride
MP auto-approved

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks, uploaded

Uploading qemu_7.0+dfsg-7ubuntu2.dsc
Uploading qemu_7.0+dfsg-7ubuntu2.debian.tar.xz
Uploading qemu_7.0+dfsg-7ubuntu2_source.buildinfo
Uploading qemu_7.0+dfsg-7ubuntu2_source.changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index d6dfb3f..1e55669 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,19 @@
6+qemu (1:7.0+dfsg-7ubuntu2) kinetic; urgency=medium
7+
8+ [ Paride Legovini ]
9+ * d/rules: disable LTO on non-amd64 builds (LP: #1921664)
10+ * GCC-12 FTBFS (LP: #1988710)
11+ - d/p/u/lp1988710-silence-openbios-array-bounds-false-positive.patch.
12+ Silence -Warray-bounds false positive (treated as error)
13+
14+ [ Christian Ehrhardt ]
15+ * More on GCC-12 FTBFS (LP 1988710)
16+ - d/rules: set -O1 for alpha firmware build
17+ - d/p/u/lp1988710-opensbi-Makefile-fix-build-with-binutils-2.38.patch:
18+ further FTBFS fixup
19+
20+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Mon, 19 Sep 2022 08:07:24 +0200
21+
22 qemu (1:7.0+dfsg-7ubuntu1) kinetic; urgency=medium
23
24 * Merge with Debian unstable (LP: #1971315)(LP: #1980896), remaining changes:
25diff --git a/debian/patches/series b/debian/patches/series
26index dae941e..01844c8 100644
27--- a/debian/patches/series
28+++ b/debian/patches/series
29@@ -36,3 +36,5 @@ ubuntu/lp-1981339-target-s390x-Remove-DISAS_GOTO_TB.patch
30 ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE.patch
31 ubuntu/lp-1981339-target-s390x-Remove-DISAS_PC_STALE_NOCHAIN.patch
32 ubuntu/lp-1981339-target-s390x-Exit-tb-after-executing-ex_value.patch
33+ubuntu/lp1988710-silence-openbios-array-bounds-false-positive.patch
34+ubuntu/lp1988710-opensbi-Makefile-fix-build-with-binutils-2.38.patch
35diff --git a/debian/patches/ubuntu/lp1988710-opensbi-Makefile-fix-build-with-binutils-2.38.patch b/debian/patches/ubuntu/lp1988710-opensbi-Makefile-fix-build-with-binutils-2.38.patch
36new file mode 100644
37index 0000000..b7c5253
38--- /dev/null
39+++ b/debian/patches/ubuntu/lp1988710-opensbi-Makefile-fix-build-with-binutils-2.38.patch
40@@ -0,0 +1,62 @@
41+From 5d53b55aa77ffeefd4012445dfa6ad3535e1ff2c Mon Sep 17 00:00:00 2001
42+From: Aurelien Jarno <aurelien@aurel32.net>
43+Date: Fri, 28 Jan 2022 18:33:46 +0100
44+Subject: [PATCH] Makefile: fix build with binutils 2.38
45+
46+From version 2.38, binutils default to ISA spec version 20191213. This
47+means that the csr read/write (csrr*/csrw*) instructions and fence.i
48+instruction has separated from the `I` extension, become two standalone
49+extensions: Zicsr and Zifencei. As the kernel uses those instruction,
50+this causes the following build failure:
51+
52+ CC lib/sbi/sbi_tlb.o
53+<<BUILDDIR>>/lib/sbi/sbi_tlb.c: Assembler messages:
54+<<BUILDDIR>>/lib/sbi/sbi_tlb.c:190: Error: unrecognized opcode `fence.i'
55+make: *** [Makefile:431: <<BUILDDIR>>/build/lib/sbi/sbi_tlb.o] Error 1
56+
57+The fix is to specify those extensions explicitly in -march. However as
58+older binutils version do not support this, we first need to detect
59+that.
60+
61+Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
62+Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
63+Tested-by: Alexandre Ghiti <alexandre.ghiti@canonical.com>
64+Reviewed-by: Anup Patel <anup@brainfault.org>
65+
66+Origin: https://gitlab.com/qemu-project/opensbi/-/commit/5d53b55aa77ffeefd4012445dfa6ad3535e1ff2c
67+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1988710
68+Last-Update: 2022-09-19
69+---
70+ roms/opensbi/Makefile | 9 ++++++++-
71+ 1 file changed, 8 insertions(+), 1 deletion(-)
72+
73+diff --git a/roms/opensbi/Makefile b/roms/opensbi/Makefile
74+index 062883e..fc1ea13 100644
75+--- a/roms/opensbi/Makefile
76++++ b/roms/opensbi/Makefile
77+@@ -153,6 +153,9 @@ OPENSBI_LD_PIE := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) $(USE_LD_FLAG) -fP
78+ # Check whether the compiler supports -m(no-)save-restore
79+ CC_SUPPORT_SAVE_RESTORE := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) -nostdlib -mno-save-restore -x c /dev/null -o /dev/null 2>&1 | grep "\-save\-restore" >/dev/null && echo n || echo y)
80+
81++# Check whether the assembler and the compiler support the Zicsr and Zifencei extensions
82++CC_SUPPORT_ZICSR_ZIFENCEI := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) -nostdlib -march=rv$(OPENSBI_CC_XLEN)imafd_zicsr_zifencei -x c /dev/null -o /dev/null 2>&1 | grep "zicsr\|zifencei" > /dev/null && echo n || echo y)
83++
84+ # Build Info:
85+ # OPENSBI_BUILD_TIME_STAMP -- the compilation time stamp
86+ # OPENSBI_BUILD_COMPILER_VERSION -- the compiler version info
87+@@ -223,7 +226,11 @@ ifndef PLATFORM_RISCV_ABI
88+ endif
89+ ifndef PLATFORM_RISCV_ISA
90+ ifneq ($(PLATFORM_RISCV_TOOLCHAIN_DEFAULT), 1)
91+- PLATFORM_RISCV_ISA = rv$(PLATFORM_RISCV_XLEN)imafdc
92++ ifeq ($(CC_SUPPORT_ZICSR_ZIFENCEI), y)
93++ PLATFORM_RISCV_ISA = rv$(PLATFORM_RISCV_XLEN)imafdc_zicsr_zifencei
94++ else
95++ PLATFORM_RISCV_ISA = rv$(PLATFORM_RISCV_XLEN)imafdc
96++ endif
97+ else
98+ PLATFORM_RISCV_ISA = $(OPENSBI_CC_ISA)
99+ endif
100+--
101+2.37.3
102+
103diff --git a/debian/patches/ubuntu/lp1988710-silence-openbios-array-bounds-false-positive.patch b/debian/patches/ubuntu/lp1988710-silence-openbios-array-bounds-false-positive.patch
104new file mode 100644
105index 0000000..b392de8
106--- /dev/null
107+++ b/debian/patches/ubuntu/lp1988710-silence-openbios-array-bounds-false-positive.patch
108@@ -0,0 +1,23 @@
109+Description: Silence array-bounds warning false positive in ppc openbios code
110+Author: Paride Legovini <paride.legovini@ubuntu.com>
111+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1988710
112+Forwarded: no
113+Last-Update: 2022-09-05
114+
115+--- a/roms/openbios/arch/ppc/qemu/init.c
116++++ b/roms/openbios/arch/ppc/qemu/init.c
117+@@ -396,11 +396,14 @@
118+ uint32_t *dsi = (uint32_t *)0x300UL;
119+ uint32_t *isi = (uint32_t *)0x400UL;
120+
121++#pragma GCC diagnostic push
122++#pragma GCC diagnostic ignored "-Warray-bounds"
123+ // Patch the first DSI handler instruction to: ba 0x2000
124+ *dsi = 0x48002002;
125+
126+ // Patch the first ISI handler instruction to: ba 0x2200
127+ *isi = 0x48002202;
128++#pragma GCC diagnostic pop
129+
130+ // Invalidate the cache lines
131+ asm ("icbi 0, %0" : : "r"(dsi));
132diff --git a/debian/rules b/debian/rules
133index 1608b56..18aab7d 100755
134--- a/debian/rules
135+++ b/debian/rules
136@@ -21,6 +21,13 @@ else
137 VENDOR := DEBIAN
138 endif
139
140+# Disable LTO on non-amd64 builds, see:
141+# https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1921664
142+# https://bugzilla.redhat.com/show_bug.cgi?id=1952483
143+ifneq ($(DEB_HOST_ARCH),amd64)
144+ export DEB_BUILD_MAINT_OPTIONS += optimize=-lto
145+endif
146+
147 # DEB_BUILD_OPTIONS=parallel=N
148 MAKEFLAGS += $(subst parallel=,-j,$(filter parallel=%,${DEB_BUILD_OPTIONS}))
149
150@@ -550,7 +557,7 @@ sysdata-components += qboot
151 build-palcode-clipper: b/qemu-palcode/palcode-clipper
152 b/qemu-palcode/palcode-clipper: | b
153 cp -al roms/qemu-palcode b/
154- ${MAKE} -C ${CURDIR}/b/qemu-palcode CROSS=${ALPHAEV67_CROSSPFX}
155+ ${MAKE} -C ${CURDIR}/b/qemu-palcode CROSS=${ALPHAEV67_CROSSPFX} OPT=-O1
156 ${ALPHAEV67_CROSSPFX}strip b/qemu-palcode/palcode-clipper
157 install-palcode-clipper: b/qemu-palcode/palcode-clipper
158 install -m 0644 $< ${sysdataidir}/palcode-clipper

Subscribers

People subscribed via source and target branches