[PATCH 10/13] xfuncs: stub out API when built for PBL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 include/xfuncs.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/include/xfuncs.h b/include/xfuncs.h
index 9e09b88141a1..e6a781ef708e 100644
--- a/include/xfuncs.h
+++ b/include/xfuncs.h
@@ -4,10 +4,12 @@
 
 #include <linux/types.h>
 #include <linux/compiler.h>
+#include <linux/bug.h>
 #include <stdarg.h>
 #include <wchar.h>
 #include <malloc.h>
 
+#ifndef __PBL__
 void *xmalloc(size_t size) __xalloc_size(1);
 void *xrealloc(void *ptr, size_t size) __xrealloc_size(2);
 void *xzalloc(size_t size) __xalloc_size(1);
@@ -22,4 +24,21 @@ wchar_t *xstrdup_wchar(const wchar_t *src);
 wchar_t *xstrdup_char_to_wchar(const char *src);
 char *xstrdup_wchar_to_char(const wchar_t *src);
 
+#else
+
+static inline void *xmalloc(size_t size) { BUG(); }
+static inline void *xrealloc(void *ptr, size_t size) { BUG(); }
+static inline void *xzalloc(size_t size) { BUG(); }
+static inline char *xstrdup(const char *s) { BUG(); }
+static inline char *xstrndup(const char *s, size_t size) { BUG(); }
+static inline void* xmemalign(size_t alignment, size_t bytes) { BUG(); }
+static inline void* xmemdup(const void *orig, size_t size) { BUG(); }
+static inline char *xasprintf(const char *fmt, ...) { BUG(); }
+static inline char *xvasprintf(const char *fmt, va_list ap) { BUG(); }
+
+static inline wchar_t *xstrdup_wchar(const wchar_t *src) { BUG(); }
+static inline wchar_t *xstrdup_char_to_wchar(const char *src) { BUG(); }
+static inline char *xstrdup_wchar_to_char(const wchar_t *src) { BUG(); }
+#endif
+
 #endif /* __XFUNCS_H */
-- 
2.39.5





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux