I am trying to assemble some 64-bit code and the assembling fails on the line:
addq $0xffffff7fc0005000, %rax
with the error:
The first operand is a 64bit value and the latter a register which should assemble fine.
It shouldn't, the 64bit version of add
can take an 8bit or 32bit sign-extended immediate, but not a 64bit immediate, which in general is rare in x64. This can be verified by looking in the Intel Software Developer's Manual or various other places, such as this online copy of the ADD lemma.
You could mov
(or movabs
as GAS likes to call this variant) a 64bit immediate into a register and then use that, or put the value in memory and use it in an add
with a memory operand.