Created attachment 6676 [details] Patch Currently, binutils can be built for Android targets, but not for Android hosts -- it just requires 2 minor changes: The getpagesize() implementation in libiberty has to be commented out because Bionic (Android's libc) defines getpagesize() in <unistd.h>, and a time() call in bfd/archive.c has to cast &status.st_mtime to time_t (st_mtime is, as expected, an unsigned long -- but time_t is typedef'ed to (signed) int. Probably a bug in Bionic - but casting explicitly can't hurt). The patch is relative to hjl's 2.23.51.0.3 release, but will probably apply to 2.24.
it can hurt if sizeof(time_t) != sizeof(status.st_mtime). in newer systems, time_t is a 64bit quantity, not 32bit (like int).
(In reply to comment #0) > Created attachment 6676 [details] > Patch > > Currently, binutils can be built for Android targets, but not for Android hosts > -- it just requires 2 minor changes: > The getpagesize() implementation in libiberty has to be commented out because > Bionic (Android's libc) defines getpagesize() in <unistd.h>, and a time() call You should update getpagesize detection instead. > in bfd/archive.c has to cast &status.st_mtime to time_t (st_mtime is, as > expected, an unsigned long -- but time_t is typedef'ed to (signed) int. > Probably a bug in Bionic - but casting explicitly can't hurt). > I think it is a bug in Bionic.
Created attachment 7298 [details] my patch for fix building binutils 2.33.2 on Android ARM I have just compiled binutils 2.33.2 on android ARM with native gcc. Please ignore shell changes from /bin/sh to /system/bin/sh. I know, it cannot be fixed. I have posted this in dependence of my successful compilation of GNU Debugger on Android. Bug http://sourceware.org/bugzilla/show_bug.cgi?id=16206 from GDB. Thanks.