From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79608 invoked by alias); 6 Nov 2015 16:27:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 79598 invoked by uid 89); 6 Nov 2015 16:27:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 06 Nov 2015 16:27:49 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A79B5293D8 for ; Fri, 6 Nov 2015 11:27:47 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kS4oByXCKtY6 for ; Fri, 6 Nov 2015 11:27:47 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 79697293AC for ; Fri, 6 Nov 2015 11:27:47 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 0FEC7436E6; Fri, 6 Nov 2015 08:27:46 -0800 (PST) From: Joel Brobecker To: gcc-patches@gcc.gnu.org Subject: [RFA] Do not use libiberty's getpagesize on Android Date: Fri, 06 Nov 2015 16:27:00 -0000 Message-Id: <1446827261-1862-1-git-send-email-brobecker@adacore.com> X-SW-Source: 2015-11/txt/msg00675.txt.bz2 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