[fpc-devel] Exception problems in FPC 3.0.0

Yury Sidorov jura at cp-lab.com
Tue Oct 27 17:43:16 CET 2015


On 10/27/2015 4:29 PM, Sergio Flores wrote:
> Yury, I think you're right, I'm using the precompiled binary that indeed
> seems to been compiled in soft-fpu mode, so that would explain
> everything, as OpenGL is probably triggering hard fpu exceptions that
> are not being caught.
>
> I tried your asm function, however adding it makes the app crash at startup.
>
> I added it to initialization of my OpenGLES unit,
> Seems that just having the function laying around, even without calling
> it, causes the crash.
>
> Checking the android log, it says the following:
> E/AndroidRuntime(10684): java.lang.UnsatisfiedLinkError: dlopen failed:
> cannot locate symbol "TERRA_OPENGLES_$$_LOADOPENGL" referenced by
> "libterra.so"...
>
> LoadOpenGL() is the only pascal function that is contained in this unit
> (it just loads the opengles library dynamically and assigns function
> pointers). For some reason, adding the assembler function to this unit
> makes this function disappear, what causes this very weird behaviour?
>
> Full unit code here:
> http://pastebin.com/h2gCcikd
>
> Commenting both the function and the function call makes the game
> startup again without crashing (albeit still crashes whevener a float
> exception happens)

I've provided wrong code. Try this one:

procedure VFP_MaskExceptions; assembler; nostackframe;
asm
   .long 0xeef10a10        // fmrx r0,fpscr
   bic r0,r0,#0x00001F00
   .long 0xeee10a10        // fmxr fpscr,r0
end;

> Probably recompiling FPC with hard float support would be the best
> solution, however compiling FPC in Windows is a frustrating game of
> trial and errors. I had written a .bat file that I used with 2.6.2, but
> it no longer works in 3.0.0. Once I have some free time I guess I will
> have to try discovering whats problem. Or if anyone has 3.0.1 compiled
> with hard-floats and can provide a download link, i would be thankful.

Building a cross compiler is a trivial task even on Windows.
Read here ho to do that: http://wiki.freepascal.org/Android

Yury.



More information about the fpc-devel mailing list