Skip to contentSkip to conversation

stubdom: Fix newlib build with GCC-14

PATCH In review Andrew Cooper 2 participants 2 messages Oct 2, 2024 – Oct 3, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stubdom: Fix newlib build with GCC-14

Based on a fix from OpenSUSE, but adjusted to be Clang-compatible too. Pass -Wno-implicit-function-declaration library-wide rather than using local GCC pragmas.

Fix of copy_past_newline() to avoid triggering -Wstrict-prototypes.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Jan Beulich <[email protected]>

The OpenSUSE Tumbleweed containers already reproduce this issue:

https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/1479445899

This wants backporting to all trees in due course.

---
 stubdom/Makefile                           |  2 ++
 stubdom/newlib-fix-copy_past_newline.patch | 10 ++++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 stubdom/newlib-fix-copy_past_newline.patch
stubdom/Makefile +2 -0
index 8c503c2bf8de..f8c31fd35d0d 100644
@@ -97,10 +97,12 @@ newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
 	patch -d $@ -p1 < newlib-disable-texinfo.patch
 	patch -d $@ -p1 < newlib-cygmon-gmon.patch
 	patch -d $@ -p1 < newlib-makedoc.patch
+	patch -d $@ -p1 < newlib-fix-copy_past_newline.patch
 	find $@ -type f | xargs perl -i.bak \
 		-pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
 	touch $@
 
+NEWLIB_CFLAGS += -Wno-implicit-function-declaration
 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
 .PHONY: cross-newlib
 cross-newlib: $(NEWLIB_STAMPFILE)
stubdom/newlib-fix-copy_past_newline.patch new file +10 -0
new file mode 100644
index 000000000000..f8452480bc80
@@ -0,0 +1,10 @@
+--- newlib-1.16.0/newlib/doc/makedoc.c.orig
++++ newlib-1.16.0/newlib/doc/makedoc.c
+@@ -798,6 +798,7 @@ DEFUN( iscommand,(ptr, idx),
+ }
+
+
++static unsigned int
+ DEFUN(copy_past_newline,(ptr, idx, dst),
+       string_type *ptr AND
+       unsigned int idx AND

base-commit: 41190d2ceb03b12ffc17a66c04de519c26a6052a

Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Andrew Cooper

Based on a fix from OpenSUSE, but adjusted to be Clang-compatible too. Pass -Wno-implicit-function-declaration library-wide rather than using local GCC pragmas.

Fix of copy_past_newline() to avoid triggering -Wstrict-prototypes.

Thanks,

Signature · 5 lines
Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech