I am learning 64-bit nasm, I assemble the .nasm file, which ONLY contains 64-bit registers, by doing the following
nasm -f elf64 HelloWorld.nasm -o HelloWorld.o
and link it doing the following
ld HelloWorld.o -o HelloWorld
the program runs correctly and even says it is a 64-bit ELF when I run the file command, but when I use objdump or gdb to disassemble the executable, the registers I put as 64-bit registers in the code show up as 32-bit registers when disassembled. (example: rax in source showing up as eax when disassembled)
Why is this?
This does not happen on just one computer, and it is a new problem, it hasn't been doing this before.
HelloWorld.nasm:
global _start
section .text
_start:
mov rax, 1
mov rdi, 1
mov rsi, hello_world
mov rdx, length
syscall
mov rax, 60
mov rdi, 11
syscall
section .data
hello_world: db 'Hello World',0xa
length: equ $-hello_world
Disassembled HelloWorld:
...
00000000004000b0 <_start>:
4000b0: b8 01 00 00 00 mov eax,0x1
4000b5: bf 01 00 00 00 mov edi,0x1
4000ba: 48 be d8 00 60 00 00 movabs rsi,0x6000d8
4000c1: 00 00 00
4000c4: ba 0c 00 00 00 mov edx,0xc
4000c9: 0f 05 syscall
4000cb: b8 3c 00 00 00 mov eax,0x3c
4000d0: bf 0b 00 00 00 mov edi,0xb
4000d5: 0f 05 syscall
...