[fpc-pascal] compiling turbo power lockbox on ubuntu 64

Andreas Schneider aksdb at gmx.de
Tue Jul 26 11:25:36 CEST 2011


At Tuesday, 26.07.2011 on 10:13 herux wrote:
> Hi,
> I use RSA encryption library lockbox turbo power.
> in a windows environment I managed to compile and the apps working well, I
> use {$ mode delphi}. 
> but when I compile it on ubuntu 64bit, there is an error when compiling
> 
> 
> component/LockBox/LbCipher.pas(708,10) Error: Unknown identifier "EBX"
> component/LockBox/LbCipher.pas(708,10) Warning: No size specified and unable
> to determine the size of the operands, using DWORD as default
> component/LockBox/LbCipher.pas(709,10) Error: Unknown identifier "EAX"
> component/LockBox/LbCipher.pas(709,10) Warning: No size specified and unable
> to determine the size of the operands, using DWORD as default
> component/LockBox/LbCipher.pas(710,13) Error: Unknown identifier "EAX"
> component/LockBox/LbCipher.pas(710,15) Error: Assembler syntax error in
> operand
> component/LockBox/LbCipher.pas(710,19) Error: Unknown identifier "EAX"
> component/LockBox/LbCipher.pas(710,19) Error: Assembler syntax error in
> operand
> component/LockBox/LbCipher.pas(711,12) Error: Unknown identifier "BH"
> component/LockBox/LbCipher.pas(711,14) Error: Unknown identifier "AL"
> component/LockBox/LbCipher.pas(712,12) Error: Unknown identifier "BL"
> component/LockBox/LbCipher.pas(712,14) Error: Unknown identifier "AH"
> component/LockBox/LbCipher.pas(713,13) Error: Unknown identifier "EBX"
> so on ...
> 
> asm delphi like code doesn't compiled right ? but why on windows compiled ?
> 
> I am trying to cross compile it in windows, for linux x86_64, and produces
> the same error.
> whether the asm code is not supported for 64bit?

Assembler code is (highly) processor dependent. x86_64 is a different architecture from x86 (well, it's actually an extension, but with certain restrictions/changes). x86_64 can still execute 32bit code, but if you want a 64bit application, the assembler code has to be written for 64bit aswell. If you want to compile for ARM, you have to write assembler for ARM. Same procedure with SPARC, POWER, etc.

In other words: you can't use that 32bit ASM when compiling as/for 64bit.

That's one of the reasons why you should avoid assembler whenever possible - and for LockBox it certainly was possible, but TurboPower liked to "optimize" their code by using loads of assembler.

-- 
Best Regards,
Andreas



More information about the fpc-pascal mailing list