This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Do not use libiberty's getpagesize on Android


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=82ef0f70744ca47057b9e95cd926dbcb25ebb0c8

commit 82ef0f70744ca47057b9e95cd926dbcb25ebb0c8
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Fri Nov 6 13:39:19 2015 -0800

    Do not use libiberty's getpagesize on Android
    
    Building libiberty on Android currently fails with the error message
    shown below.  This was discovered by trying to build GDBserver
    for Android, which stopped building after libiberty became
    a GDBserver dependency.
    
    Here is the error message:
    
    [...]/getpagesize.c:64:1: error: redefinition of 'getpagesize'
    In file included from /[...]/getpagesize.c:34:0:
    /[...]/usr/include/unistd.h:171:23: note: previous definition of 'getpagesize' was here
    
    And looking at the definition, one can see that it defined as
    a static inline function...
    
       static __inline__ int getpagesize(void) {
         extern unsigned int __page_size;
         return __page_size;
       }
    
    ... which explains why the AC_CHECK_FUNCS test failed to detect
    the function, since there is no associated symbol to be linked in.
    
    This patch prevents getpagesize.c to be compiled in by hard-coding
    the fact that getpagesize is available on android hosts.
    
    libiberty/ChangeLog:
    
            * configure.ac: Set AC_CV_FUNC_GETPAGESIZE to "yes" on
            Android hosts.
            * configure: Regenerate.

Diff:
---
 libiberty/ChangeLog    | 6 ++++++
 libiberty/configure    | 6 ++++++
 libiberty/configure.ac | 6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 5b9a8cf..0688ba8 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,9 @@
+2015-11-06  Joel Brobecker  <brobecker@adacore.com>
+
+	* configure.ac: Set AC_CV_FUNC_GETPAGESIZE to "yes" on
+	Android hosts.
+	* configure: Regenerate.
+
 2015-09-30  Nick Clifton  <nickc@redhat.com>
 
 	Import the following patches from the GCC mainline:
diff --git a/libiberty/configure b/libiberty/configure
index d8890a1..720dc5e 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -6248,6 +6248,12 @@ if test -z "${setobjs}"; then
 
   case "${host}" in
 
+  *-*-android*)
+    # On android, getpagesize is defined in unistd.h as a static inline
+    # function, which AC_CHECK_FUNCS does not handle properly.
+    ac_cv_func_getpagesize=yes
+    ;;
+
   *-*-mingw32*)
     # Under mingw32, sys_nerr and sys_errlist exist, but they are
     # macros, so the test below won't find them.
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index 868be8e..e21e3aa 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -600,6 +600,12 @@ if test -z "${setobjs}"; then
 
   case "${host}" in
 
+  *-*-android*)
+    # On android, getpagesize is defined in unistd.h as a static inline
+    # function, which AC_CHECK_FUNCS does not handle properly.
+    ac_cv_func_getpagesize=yes
+    ;;
+
   *-*-mingw32*)
     # Under mingw32, sys_nerr and sys_errlist exist, but they are
     # macros, so the test below won't find them.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]