Hello all,
I am using FPC 2.6.4 together with Lazarus 1.4.2 under Ubuntu 15.04 LTS.
I want to move former inline asm to an external asm file which I can assemble with NASM (to gain access to extended asm mnemonics like ADCX, MULX, SHLX etc.) and link the resulting object to a Pascal unit like
...
uses
...
{$link LongArith-SL.o}
...
function sBitLen( Op1: QWORD ):QWORD;external;
...
I use NASM as the assembler of choice with a respective (to the above) declaration like
global sBitLen:function
...
align 16
sBitLen:
I assemble with
NASM -f elf64 -g LongArith-SL.asm
which produces the requested object file in the active directory including stabs debugging info. I also set stabs as the debugger info-type in the Lazarus environment. I also checked in the documentation that linked objects are searched in the active directory - which seems to work as I am not getting a file-not-found error (or similar response) on the Pascal {$link ...} statement above.
However I don't get this working - during linking I do get errors that external functions are not available. I suspect it has something to do with the Pascal name-mangling - but reading the docs (FPC and NASM) did not make me any the wiser.
I am sure it is a trivial thing I am doing wrong ...
Kind regards,
MathMan