public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFA] Do not use libiberty's getpagesize on Android
@ 2015-11-06 16:27 Joel Brobecker
  2015-11-06 19:35 ` DJ Delorie
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2015-11-06 16:27 UTC (permalink / raw)
  To: gcc-patches

Hello,

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.

OK to apply?

Thank you!
-- 
Joel

---
 libiberty/configure    | 6 ++++++
 libiberty/configure.ac | 6 ++++++
 2 files changed, 12 insertions(+)

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.
-- 
2.1.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] Do not use libiberty's getpagesize on Android
  2015-11-06 16:27 [RFA] Do not use libiberty's getpagesize on Android Joel Brobecker
@ 2015-11-06 19:35 ` DJ Delorie
  2015-11-06 21:43   ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: DJ Delorie @ 2015-11-06 19:35 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gcc-patches


> libiberty/ChangeLog:
> 
>         * configure.ac: Set AC_CV_FUNC_GETPAGESIZE to "yes" on
>         Android hosts.
>         * configure: Regenerate.
> 
> OK to apply?

Ok.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] Do not use libiberty's getpagesize on Android
  2015-11-06 19:35 ` DJ Delorie
@ 2015-11-06 21:43   ` Joel Brobecker
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2015-11-06 21:43 UTC (permalink / raw)
  To: DJ Delorie; +Cc: gcc-patches

> > libiberty/ChangeLog:
> > 
> >         * configure.ac: Set AC_CV_FUNC_GETPAGESIZE to "yes" on
> >         Android hosts.
> >         * configure: Regenerate.
> > 
> > OK to apply?
> 
> Ok.

Thank you, DJ. committed in gcc's SVN, and pushed to binutils-gdb.

-- 
Joel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-06 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-06 16:27 [RFA] Do not use libiberty's getpagesize on Android Joel Brobecker
2015-11-06 19:35 ` DJ Delorie
2015-11-06 21:43   ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).