[PATCH 4/5] stubdom: Fix -Wimplicit-int in newlib

Andrew Cooper posted 5 patches 2 months, 3 weeks ago
There is a newer version of this series
[PATCH 4/5] stubdom: Fix -Wimplicit-int in newlib
Posted by Andrew Cooper 2 months, 3 weeks ago
This is an error now Debian Trixie's gcc-14

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Anthony PERARD <anthony.perard@vates.tech>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Julien Grall <julien@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Samuel Thibault <samuel.thibault@ens-lyon.org>
CC: Juergen Gross <jgross@suse.com>

I really think we need to move onto Unikraft as a maintained base...
---
 stubdom/Makefile               |  1 +
 stubdom/newlib-fix-etext.patch | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 stubdom/newlib-fix-etext.patch

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 666c3221dcd7..9aa0d3dee4de 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -94,6 +94,7 @@ newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
 	patch -d $@ -p1 < newlib-cygmon-gmon.patch
 	patch -d $@ -p1 < newlib-makedoc.patch
 	patch -d $@ -p1 < newlib-fix-copy_past_newline.patch
+	patch -d $@ -p1 < newlib-fix-etext.patch
 	find $@ -type f | xargs perl -i.bak \
 		-pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
 	touch $@
diff --git a/stubdom/newlib-fix-etext.patch b/stubdom/newlib-fix-etext.patch
new file mode 100644
index 000000000000..e7bd4bb0cead
--- /dev/null
+++ b/stubdom/newlib-fix-etext.patch
@@ -0,0 +1,23 @@
+GCC-14 in Debian Trixie i386 complains:
+
+../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c: In function '_mcount':
+../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:227:14: error: type defaults to 'int' in declaration of '_etext' [-Wimplicit-int]
+  227 |       extern _etext();
+      |              ^~~~~~
+../../../../newlib-1.16.0/libgloss/i386/cygmon-gmon.c:228:14: error: type defaults to 'int' in declaration of '_ftext' [-Wimplicit-int]
+  228 |       extern _ftext();
+      |              ^~~~~~
+
+--- newlib-1.16.0/libgloss/i386/cygmon-gmon.c.orig	2025-08-09 22:48:09.864068481 +0100
++++ newlib-1.16.0/libgloss/i386/cygmon-gmon.c	2025-08-09 22:52:18.458393484 +0100
+@@ -224,8 +224,8 @@
+ 
+   if (! already_setup) 
+     {
+-      extern _etext();
+-      extern _ftext();
++      extern char _etext[];
++      extern char _ftext[];
+       already_setup = 1;
+       monstartup(_ftext, _etext);
+       atexit(_mcleanup);
-- 
2.39.5


Re: [PATCH 4/5] stubdom: Fix -Wimplicit-int in newlib
Posted by Jürgen Groß 2 months, 3 weeks ago
On 10.08.25 00:12, Andrew Cooper wrote:
> This is an error now Debian Trixie's gcc-14
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Juergen Gross <jgross@suse.com>

> ---
> CC: Anthony PERARD <anthony.perard@vates.tech>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Julien Grall <julien@xen.org>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Samuel Thibault <samuel.thibault@ens-lyon.org>
> CC: Juergen Gross <jgross@suse.com>
> 
> I really think we need to move onto Unikraft as a maintained base...

This would require a _lot_ of work to reach feature parity (ballooning,
kexec come to my mind immediately).

I'm not sure when Unikraft took Mini-OS as the base, but it seems to have
happened before I added ballooning, so 4.7 or earlier.

It probably would be easier to "just" take an up-to-date newlib for Mini-OS
(btw, Unikraft is based on newlib 2.5, which isn't up-to-date either).

OTOH using Unikraft would give us Arm support "for free", which wouldn't be
a minor effort to add to Mini-OS.

So I'm not opposed to switch to Unikraft, but before starting this adventure
I'd like to discuss a path to feature parity compared to Mini-OS with the
Unikraft community (especially looking at Xenstore support including live
update).


Juergen