Background:
So I recently began porting my A* C++ implementation to Assembly using NASM. The C++ version is currently very fast and leaves a light memory footprint, but being the speed demon that I am, I decided to go with an Assembly implementation, to see if I could squeeze out a couple more nano seconds from the algorithm.
Problem/Question:
mov rbx, [Node.BaseCost]
NASM will assemble this, but LD (GNU Linker) won't link it giving an error;
Node.o64:Node.asm:(.text+0x4): relocation truncated to fit: R_X86_64_32 against `.data'
This can be remedied by doing;
mov rbx, Node.BaseCost
mov rbx, [rbx]
But that is obviously slower and more cumbersome to do. The solution, it seems is to use RIP-relative addressing;
mov rbx, [rel Node.BaseCost]
When I do this the the GNU Linker links with no errors, and the code works as intended, but NASM gives me a warning when assembling;
Node.asm:57: warning: absolute address can not be RIP-relative
So my question is why does the warning occur, and can I safely ignore it considering my code works as intended?
Platform:
Windows 10, Cygwin64
Assembling/Linking + Options:
nasm64 -Wall -g -F cv8 -f win64 Node.asm -o Node.o64 -l Node.lst
ld -e main Node.o64 -Map=Node.map -o NodeTest.exe
Thank you.