NASM does not support self-relative addresses from code to data, but YASM does. As YASM is no longer maintained, I have to port my code to NASM. Therefore this request.
I am making self-relative code in 32 bit mode without a GOT in this way:
.data mydata dd 0 .code call get_esp_into_ecx ecx_points_here: mov eax,[ecx + (mydata - ecx_points_here] ; read mydata ret get_esp_into_ecx: mov ecx,[esp] ; this function reads its own return address ret
This is the same method that is used for making position-independent code in a Unix shared object, except I want to get rid of the slow GOT lookup.
As I said, this works in YASM, while NASM says error: beroset-p-637-invalid effective address
What is needed is a self-relative address, similar to the rip-relative address in 64-bit mode.
Could you please use bugzilla.nasm.us for future requests, we're trying to minimize use of SF buckracking.
Sorry. I have moved it to
http://bugzilla.nasm.us/show_bug.cgi?id=3392263