[PATCH v3 3/4] tools/nolibc: implement fd-based FILE streams

Mark Brown broonie at kernel.org
Thu Apr 13 07:20:16 PDT 2023


On Thu, Apr 13, 2023 at 03:09:27PM +0200, linux at weissschuh.net wrote:
> Apr 12, 2023 17:58:45 Mark Brown <broonie at kernel.org>:

> > Nothing in this change (or anything else in the series AFAICT) causes
> > STDx_FILENO to be declared so we get errors like below in -next when a
> > kselftest is built with this version of nolibc:

> These definitions come from
> "tools/nolibc: add definitions for standard fds".
> This patch was part of the nolibc stack protector series which is older than this series and went through the same channels.
> So I'm not sure how one series made it into next and the other didn't.

> This would also have been noticed by Willy and Paul running their tests.

Hrm, that commit is actually in -next and Paul's pull request, not sure
why it wasn't showing up in greps.  The issue is that you've added a
dependency from nolibc's stdio.h to unistd.h but nolibc.h includes
unistd.h last and there's no other include, meaning that at the time
that stdio.h is compiled there's no definition of the constants visible.

The below fixes the issue, I'll submit it properly later today:

diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
index 04739a6293c4..05a228a6ee78 100644
--- a/tools/include/nolibc/nolibc.h
+++ b/tools/include/nolibc/nolibc.h
@@ -99,11 +99,11 @@
 #include "sys.h"
 #include "ctype.h"
 #include "signal.h"
+#include "unistd.h"
 #include "stdio.h"
 #include "stdlib.h"
 #include "string.h"
 #include "time.h"
-#include "unistd.h"
 #include "stackprotector.h"
 
 /* Used by programs to avoid std includes */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20230413/73debdd9/attachment-0001.sig>


More information about the linux-arm-kernel mailing list