Assembly language > Assembly discussions

About addressing in x64

(1/3) > >>

themaster:
Trying to write assembler x64 code. Found a problem:linker says
Relocation type ADDR32 is invalid without /LARGEADDRESSAWARE:NO, for symbol 'hInstance'
about such code:

--- Code: ---.data
hInstance dq ?
.code
main proc
        ...
mov rcx, hInstance ; ...

--- End code ---
It is because some problems of addressing and writing parameters of 'mov' instruction.
I can use parameter  /LARGEADDRESSAWARE:NO, and error will disappear.
But how should I write instruction 'mov' and it's parameters, if I just want to get a value from memory and put it into general purpose register, in 'pure' x64, not using x32?
Something like this question was asked here:
http://forum.pellesc.de/index.php?topic=2920.msg11064
but forum recommended me to post a new topic, not reply in existing.

Greenhorn:
Hi,

I don't know if it is the best solution, but you can do it like this:
lea rcx, hInstance
mov rcx, qword ptr [rcx]

Bitbeisser:
You are looking in the wrong direction for your (non-)problem here I guess...

The problem is not to "write" this type of code, but rather that in "pure 64bit code", you have an address range larger than 2GB. As you state yourself, the error message is from the linker (not the assembler), which requires that you add the /LARGEADDRESSAWARE:NO parameter so that it (the linker) knows how to handle the relocation info for that particular assembler module...

Ralf

Greenhorn:
If you set the option /LARGEADDRESSAWARE:NO your application can only handle addresses lower than 2GB.
As I understand the documentation right, this is not related to a particular (object-)module.
Please correct me if I'm wrong...


--- Quote ---The /LARGEADDRESSAWARE option tells the linker that the application can handle addresses larger than 2 gigabytes. In the 64-bit compilers, this option is enabled by default. In the 32-bit compilers, /LARGEADDRESSAWARE:NO is enabled if /LARGEADDRESSAWARE is not otherwise specified on the linker line.

If an application was linked with /LARGEADDRESSAWARE, DUMPBIN /HEADERS will display information to that effect.
--- End quote ---
http://msdn.microsoft.com/en-us/library/wz223b1z

If I remember it right, I had this problem only with external symbols/tables...

CommonTater:

--- Quote from: Greenhorn on June 21, 2012, 07:52:16 PM ---If you set the option /LARGEADDRESSAWARE:NO your application can only handle addresses lower than 2GB.

--- End quote ---

If you set the option /LARGEADDRESSAWARE:NO your 32 bit application can only handle addresses lower than 2GB.

64 bit aps suffer no such limitation but all addressing is done with 64bit registers.

Navigation

[0] Message Index

[#] Next page

Go to full version