This is the mail archive of the gdb@sourceware.org mailing list for the GDB 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]

Re: Building gdb for Android using Android-ndk


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


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