Pelles C > Bug reports

Relocation type ADDR32 is invalid without /LARGEADDRESSAWARE:NO

(1/2) > >>

MichaelW:
Using Version 8.00.60 (Win64), under Windows 8.1, 64-bit, No service pack (Build 9600)

I have a C main and an asm module with the relevant parts:

--- Code: ---.data
itoa64_digits db "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
.code
itoa64 proc value:QWORD, string:QWORD, _radix:QWORD
...
movzx   rdx, BYTE PTR itoa64_digits[rax]
...
itoa64 endp

--- End code ---

My initial attempts to build the project returned the error message:

Relocation type ADDR32 is invalid without /LARGEADDRESSAWARE:NO, for symbol 'itoa64_digits'.

I tried the build with "Large address aware" check box on the project options linker tab checked and unchecked, and got the same error message either way. I could not find anything relevant in the documentation, so I tried pasting -largeaddressaware:no in the library and object files field of the project linker options tab, and was able to do the build with no errors. When I returned to the project linker options tab the -largeaddressaware:no was missing from the library and object files field, and the "Large address aware" check box was checked, but as long as I didn't change anything on the tab, I could continue to build the project with no errors. I didn't try every possibility, but even checking the Generate MAP file check box would cause the error to return.

moreson:
Definitely seems like a bug if it keeps removing that flag.

But you should really think twice about wanting to use absolute 32 bit addresses in 64 bit programs, for the most part they will work, but for a dll it's a really bad idea because most of Windows is gonna assume 64-bit programs can be relocated above 4G addresses and would potentially truncate your addresses.
You should get used to RIP relative addressing in x64, makes your code trivially PIC and will just work wherever it gets relocated at.

--- Code: ---lea r10, [rip+itoa64_digits]
movzx edx, byte ptr [r10+rax]

--- End code ---

MichaelW:
It was not my intention to use absolute 32-bit addresses. I'm using 64-bit registers in 64-bit code, and expected 64-bit addresses. Your example code does work, but it involves two instructions. I can address the data with this:

--- Code: ---movzx   rdx, BYTE PTR itoa64_digits[rip]

--- End code ---

But I cannot find any syntax that will allow me to include the RAX index, or even a displacement.

moreson:
With RIP relative addressing you cannot include any index or scale in the addressing mode, there's only the RIP+signed32offset encoding.
So indexing local arrays on 64 bit does indeed require more instructions compared to 32 bit (unless you use absolute 32 bit addresses and make sure all pointers are below 4GB).
You do make up for it when referencing global or shared variables or functions though where 32 bit PIC code is quite a few more instructions (and memory loads).

bitcoin:
I have such error with code:

Asm

--- Code: ---.data
extern PA : qword
.code
RunASM proc
jmp qword ptr [PA]
RunASM endp
end


--- End code ---

--- Code: ---FARPROC p[17];
...
PA = p[0];
RunASM();

--- End code ---

I try to compile some project, but have this error.

Navigation

[0] Message Index

[#] Next page

Go to full version