Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-07

compiling turbo power lockbox on ubuntu 64

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

herux

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?

-----
-

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/compiling-turbo-power-lockbox-on-ubuntu-64-tp4634016p4634016.html Sent from the Free Pascal - General mailing list .
Andreas Schneider
to herux
herux wrote 31 lines
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
Ludo Brands
to herux: I use RSA encryption library lockbox turbo power. in a windows environment I managed to…
Show quoted text 29 lines
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 ...

These errors indicate that the wrong assembler style is selected. Use Intel mode: {$asmmode intel}
This isn't going to solve your problem though. Variable parameters are 64 bit and passed in rax, rdx, not eax, edx. Pushing and popping registers becomes push rsi instead of push esi. Register relative addressing is [rsi] instead of [esi], etc. etc. etc.

Ludo

Andreas Schneider
to herux
herux wrote
thanks for the info for you guys, where can I read the complete freepascal asm document for 64bit ?

Assembler is not FreePascal specific.

But before you rewrite that Assembler into x86_64 compatible Intel assembler, you better rewrite it into native (Object)Pascal and get rid of the assembler 's a lot easier to write and to maintain. Plus you also get rid of platform specific code and most likely even gain performance, since the old code probably doesn't utilize all the current extensions like SSE(2, 3, 4, ...) and other things the compiler MIGHT do better.

Best Regards, Andreas