[PATCH 09/13] errno: stub out perror/strerror API when built for PBL

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Oct 16 02:01:46 PDT 2024


To optimize out calls to undefined functions in PBL at compile-time
instead of link time, let's define stubs for the functions that
are referenced in obj-pbl-y files, but inside function sections
that are ultimately unreferenced.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/errno.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/errno.h b/include/errno.h
index 12e526a0d7ed..9a008e375221 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -7,8 +7,18 @@
 
 extern int errno;
 
+#ifndef __PBL__
 void perror(const char *s);
 const char *strerror(int errnum);
+#else
+static inline void perror(const char *s)
+{
+}
+static inline const char *strerror(int errnum)
+{
+	return NULL;
+}
+#endif
 
 static inline int errno_set(int err)
 {
-- 
2.39.5




More information about the barebox mailing list