Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: "Bernd Späth" <s1237382@stud.uni-frankfurt.de>
Cc: gdb@sourceware.org
Subject: Re: Building gdb for Android using Android-ndk
Date: Thu, 04 Apr 2013 09:43:00 -0000	[thread overview]
Message-ID: <515D4B4D.5060408@redhat.com> (raw)
In-Reply-To: <35190382.post@talk.nabble.com>

On 03/18/2013 11:40 PM, Bernd Späth wrote:

> Stumbeling across a similar error that the one you reported in trying to
> compile a package depending on libiberty:
> 
> 'sysroot/usr/include/unistd.h:171:23: note: previous definition of
> 'getpagesize' was here'
> 
> I managed to track down the problem to the following issue:
> 
> sysroot/usr/include/unistd.h
> ---
> static __inline__ int getpagesize(void) {
>   extern unsigned int __page_size;
>   return __page_size;
> }
> 
> Unfortunately besides claiming AC_REPLACE_FUNC will (by by some kind of
> black magic, voodoo or whatever) just do the right thing. The autoconf
> manual doesn't give any clue on how this check will be done so hunting down
> the problem took me just a while.
> 
> As it turns out in determinig if a function is available the autoconf macro
> doesn't really give a damn thing about headers. Instead relying on
> prototypeless ANSI C fallback mode it just compiles a binary using a call to
> the tested func: <function-name>().
> Running the generated executable would sure crash if <function-name> was
> anything else but int <function-name> (void).
> This never happens as autoconf will never run the generated binary at all.
> The whole trick involved is to see if the linker is able to resolve the
> symbol <function-name> in generating the executable.
> 
> For the tricky getpagesize() implementation cited above this tricky method
> fails as it is just the symbol __page_size that gets exported by libc.
> As the coresponding header (unistd.h) in this case never gets included in
> the autoconf test the static function definition of getpagesize will be
> missing fooling the linker into thinking getpagesize would have to be
> resolved.
> 
> Finding the right spot to fix to elegantly fix the issue doesn't seem too
> easy. At least I wasn't clever enough to spot it.

FYI, libiberty is maintained by the gcc folks.  You may want to report this
there.  Any patch needs to go there first, and is then brought into gdb
via a merge.

-- 
Pedro Alves


      parent reply	other threads:[~2013-04-04  9:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23  9:29 Robert
2013-01-23 13:40 ` Pedro Alves
2013-01-23 14:54   ` Robert
2013-01-23 14:58     ` Pedro Alves
     [not found]       ` <35190382.post@talk.nabble.com>
2013-04-04  9:43         ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=515D4B4D.5060408@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=s1237382@stud.uni-frankfurt.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox