[fpc-devel] rev 19036 breaks the Android cross-compiler

Thomas Schatzl tom_at_work at gmx.at
Tue Nov 15 16:59:47 CET 2011


Hi,

On Tue, 2011-11-15 at 15:42 +0100, Felipe Monteiro de Carvalho wrote:
> On Tue, Nov 15, 2011 at 3:35 PM, Thomas Schatzl <tom_at_work at gmx.at> wrote:
> > Maybe you're using an already partially patched crosscompiler.
> 
> No, I am not. I built it myself in 19/Jan without any patches against
> fpc trunk and uploaded it here:
> 
> http://sourceforge.net/projects/p-tools/files/Free%20Pascal%20for%20ARM/
> 
> And ever since it worked excelently.
> 
> So if anything was broken before rev19036 it was after 19th January or
> it requires something special to reproduce. So far I haven't found any
> issues with libraries or even executables built with that
> cross-compiler while running on Android.
> 

If you have a look at the arm-linxu/dllprt0.as as of 19th of January
(http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/rtl/linux/arm/dllprt0.as?revision=15484&view=markup) you will see that it does not initialize argc, argv and envp variables. Actually it does nothing.
Even without assembler knowledge you will see that these variables are
never even referenced in that code, while it is the responsibility of
that code, just have a look at other startup code. You will get whatever
has been in them before initialization, most likely NULL values if you
are loading the library at startup.

Additionally, that startup code does not call shared library
initialization either (initialization sections), and does not register a
finalization function, i.e. finalization of shared libraries does not
work. Only r19036 implemented that for all Linux platforms.

Looking more closely at android, there might be even more
incompatibilities and differences to arm-linux than discussed so far.
E.g. I also think (not sure) that its libc is the official interface to
the OS functions too, so you probably should not use syscalls there but
by default interface to libc (similar to OS X).
Android does not advertise Linux compatibility after all.

That's why I suggested and support effort on implementing that using a
different target.

As already mentioned, I will spend time on it, but do not expect
anything quickly for reasons already explained.

Thomas





More information about the fpc-devel mailing list