Forum > FPC development

Cross compiler (from 32-bit linux to 32-bit Windows) SEH problem.

(1/2) > >>

Cyrax:
I'm using FPC trunk.

In short; when building a cross compiler for 32-bit Windows, there is no support for SEH exception handling even -dTEST_WIN32_SEH is added at make build options. This will cause e.g 32-bit DoubleCommander to quit unexpectedly shortly after it is executed under 32-bit Wine environment. No error messages are displayed.

PascalDragon:
How did you build the cross compiler? A "make clean all OS_TARGET=win32 CPU_TARGET=i386 OPT=-dTEST_WIN32_SEH" should be the way to do it. Does a simple test application raising and catching an exception work? Does it work on Windows?

Cyrax:
I use this make command line to build the cross compiler:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---make all OS_TARGET=win32 CPU_TARGET=i386 OPT="-gw2 -godwarfsets -godwarfmethodclassprefix -gl -O- -Xs- -Si- -vbq -Sew- -dEXTDEBUG -Xd -Fl/usr/lib32 -dTEST_WIN32_SEH" COMPILER_OPTIONS="-gw2 -godwarfsets -godwarfmethodclassprefix -gl -O- -Xs- -Si- -vbq -dEXTDEBUG -Sew- -Xd -Fl/usr/lib32 -dTEST_WIN32_SEH" FPC=fpc REVSTR=39872 UPXPROG=echo NOWPOCYCLE=1 ALLOW_WARNINGS=1

Cyrax:
In attached file (project1.zip) you will find test project.

Under Wine 32-bit it will output following text :
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---An unhandled exception occurred at $004016ED:EDivByZero: Division by zero  $004016ED  main,  line 20 of project1.lpr
Under Wine 64-bit it will output following text :
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Windows 32/64-bit SEH is used.Division by zero
I also attached project1.s assembler file for respective OSes.

PascalDragon:
Your Win32 assembly code does not show that it has been compiled with a SEH-enabled compiler. You should see accesses to %fs:(x) instead of fpc_setjmp in the assembly output. Your output however should already have told you that however as the "Windows 32/64-bit SEH is used" line is missing.

I also compiled a cross compiler from Linux to Windows locally (though only with -dTEST_WIN32_SEH as option) and your example came out without any problems. So you should probably check whether something in your building went wrong.

Also a few notes regarding your build line:
- COMPILER_OPTIONS is only needed if you want to add options *only* for the compiler; however the options passed to OPT are passed to the compiler as well, so passing the same values is superfluous
- UPXPROG is not required anymore as we've removed UPX support some time ago already
- passing ALLOW_WARNINGS and -Sew- is essentially the same as well

Navigation

[0] Message Index

[#] Next page

Go to full version