[PATCH v2 12/16] errno: stub out perror/strerror API when built for PBL
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Nov 25 07:12:24 PST 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..fd358e1c1103 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -7,8 +7,18 @@
extern int errno;
+#if IN_PROPER
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 "unknown error";
+}
+#endif
static inline int errno_set(int err)
{
--
2.39.5
More information about the barebox
mailing list