Mon, 03-Sep-2012 by reneeb edit post
#includeRunning nm gets us:#$i_stdlib I_STDLIB #ifdef I_STDLIB #include #endif int PERL_INT_SIZE; long PERL_LONG_SIZE; short PERL_SHORT_SIZE; int main() { exit(0); } EOCP
$ /usr/src/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-nm -p -t d -S UU/try
00037740 d _DYNAMIC
00037940 d _GLOBAL_OFFSET_TABLE_
00033612 A __exidx_end
00037996 A _bss_end__
00037724 T __FINI_ARRAY__
00037960 A __bss_start__
00037968 00000004 B __dso_handle
00033612 A __exidx_start
00037984 00000004 B PERL_LONG_SIZE
00037988 00000004 B PERL_INT_SIZE
U __libc_init
00037992 00000002 B PERL_SHORT_SIZE
00037732 D __CTOR_LIST__
00037996 A __bss_end__
00033552 T _start
00037716 T __INIT_ARRAY__
00037960 A __bss_start
00033600 00000012 T main
00037996 A __end__
00037708 D __PREINIT_ARRAY__
00037960 A _edata
00037996 A _end
U exit
00037960 D __data_start
And we extract the values for the PERL_* variables. The same process is repeated for long longs, long doubles, pointers etc. Assuming cross-compile environments all use gcc and contain the bin-utils, this ought to be fairly portable.
To ensure the correct 'nm' (and also later 'ar') is used, I've added support to Configure to allow the binaries to be named differently. The cross-compiler 'nm' for the NDK is, for example, 'arm-linux-androideabi-nm'. If "-Dusecrosscompile=arm-linux-androideabi-" is passed as a Configure argument, binaries will be discovered with that string as a prefix.
I've now started to add support for -Dsysroot. The name is taken from the gcc option mentioned earlier, and is similar to chroot, it specifies a logical root directory under which headers and libraries can be found. Various parts of the Configure script try to discover which libraries are available, and the location of the libc.so, using absolute paths. When cross-compiling, these are being found on the host system, instead of inside the toolchain for the cross-compiler. Adding sysroot support means the compiler's headers and libraries can now be located correctly. This is applicable to any system with its compiler located in its own chroot, or multiple toolchains / libraries installed.
[Hours] [Activity] 5.75 Admin - Tasks, Emails, Planning 6.50 Remove agcc from x-cross-compile branch 2.00 Update to latest Android NDK and verify working with x-cross-compile 10.50 Update Configure with better cross-compiling support ===== 24.75 hours total
The Perl Foundation - supporting the Perl community since 2000. Find out more at www.perlfoundation.org.