View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038074 | FPC | Compiler | public | 2020-11-13 15:46 | 2020-11-13 22:39 |
Reporter | Antero Hiismäki | Assigned To | Florian | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Product Version | 3.2.0 | ||||
Fixed in Version | 3.3.1 | ||||
Summary | 0038074: Compiler BUG inline assembly intel immediate 64-bit load to register when requesting 64-bit nasm -compatible output | ||||
Description | for example: {$ASMMODE INTEL} function Test:Int64; asm mov RAX, $1234567898765432 end; the compiler loads only the LOW32 bits of the immediate parameter into RAX, ignoring the HIGH32 bits. | ||||
Steps To Reproduce | How to reproduce: {$ASMMODE INTEL} function Test:Int64; asm mov RAX, $1234567898765432 end; 1. Put the Test function above in a program, and compile using the following command line: ppcrossx64 -Anasmwin64 Test1 2. Look at the generated Test1.s: SECTION .text ALIGN 16 GLOBAL P$TEST1_$$_TEST$$QWORD P$TEST1_$$_TEST$$QWORD: ..@c1: lea rsp,[rsp-8] ..@c3: CPU x64 mov rax,-1737075662 CPU x64 lea rsp,[rsp+8] ret ..@c2: ; End asmlist al_pure_assembler The compiler-generated constant -1737075662 converted to HEX is $98765432, totally ignoring the HIGH 32 bits. The odd thing is that IF you compile direct-to-EXE (bypassing the assembly language output meant for 64-bit nasm assembly), then the compiler will produce the correct code to load the full 64-bit constant. But I wanted to write part of my code in objectpascal, and convert that to nasm source code, write more code directly in assembly language and use nasm to combine both into one single 64-bit executable code. also: I get the following error message: "Assembling test1 Test1.pas(98,60) Error: Assembler x86_64-win64-nasm.exe not found, switching to external assembling" does that mean I should copy the nasm.exe as "x86_64-win64-nasm.exe" and put that in the same directory where "ppcrossx64" already exists ? Not that it really matters in this case, because I don't want to directly compile to EXE anyway, but instead use the freepascal assembly language output as part of input to nasm, and write some other code directly in assembly language and feed the comination to nasm. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 47413 | ||||
FPCOldBugId | |||||
FPCTarget | - | ||||
Attached Files |
|
|
> I get the following error message: > > "Assembling test1 > Test1.pas(98,60) Error: Assembler x86_64-win64-nasm.exe not found, switching to > external assembling" > > does that mean I should copy the nasm.exe as "x86_64-win64-nasm.exe" and put that in the same directory where "ppcrossx64" already exists ? Per default the compiler looks for <cpu>-<os>-xxx when searching for external utilities (assembler, linker, etc.) and searches these in the compiler directory as well as %PATH%. You can adjust that with the options -XPxxx (binary utility prefix, can be set to empty by simply passing -XP ) and -FDxxx (the directory where utilities are looked for). |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-11-13 15:46 | Antero Hiismäki | New Issue | |
2020-11-13 15:51 | Sven Barth | Note Added: 0126879 | |
2020-11-13 22:39 | Florian | Assigned To | => Florian |
2020-11-13 22:39 | Florian | Status | new => resolved |
2020-11-13 22:39 | Florian | Resolution | open => fixed |
2020-11-13 22:39 | Florian | Fixed in Version | => 3.3.1 |
2020-11-13 22:39 | Florian | Fixed in Revision | => 47413 |
2020-11-13 22:39 | Florian | FPCTarget | => - |