[Toybox] [PATCH] Fix 32-bit bionic toybox build.

enh enh at google.com
Fri Jul 10 19:25:31 PDT 2015


(already submitted as https://android-review.googlesource.com/159035/
--- i was under pressure because i didn't notice the problem until i'd
already broken all the 32-bit builds. as usual i tested on 64-bit.
i've removed the non-standard basename_r and dirname_r from 64-bit
bionic, but i can't fix the past. the build failure is because the
32-bit bionic basename_r had the signature int basename_r(const char*,
char*, size_t). looking ahead maybe i should add a _BIONIC_NO_CRUFT so
non-historic 32-bit code can opt out of this kind of pollution.)

commit f8b41e81fca2b53410f80c95f111c754d5eff99a
Author: Elliott Hughes <enh at google.com>
Date:   Fri Jul 10 19:11:18 2015 -0700

    Fix 32-bit bionic toybox build.

    Change-Id: Ief60448ec3dddf88e0202fafaefa3c79462a3e70

diff --git a/lib/portability.h b/lib/portability.h
index f83cab6..ff22fa5 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -79,7 +79,7 @@ char *strptime(const char *buf, const char *format,
struct tm *tm);
 // correct name to the broken name.

 char *dirname(char *path);
-char *__xpg_basename (char *path);
+char *__xpg_basename(char *path);
 static inline char *basename(char *path) { return __xpg_basename(path); }

 // uClibc pretends to be glibc and copied a lot of its bugs, but has a few more
@@ -154,11 +154,19 @@ int utimensat(int fd, const char *path, const
struct timespec times[2], int flag

 #endif // glibc in general

-#ifndef __GLIBC__
+#if !defined(__GLIBC__) && !defined(__BIONIC__)
 // POSIX basename.
 #include <libgen.h>
 #endif

+// glibc was handled above; for 32-bit bionic we need to avoid a collision
+// with toybox's basename_r so we can't include <libgen.h> even though that
+// would give us a POSIX basename(3).
+#if defined(__BIONIC__)
+char *basename(char *path);
+char *dirname(char *path);
+#endif
+
 // Work out how to do endianness

 #ifndef __APPLE__

 1436581531.0


More information about the Toybox mailing list