S
S
slinkinone2017-02-03 16:15:04
assembler
slinkinone, 2017-02-03 16:15:04

NASM - Why do I get different byte codes for one asm file (compilations to elf and binary output to a file)?

Hello!
There is a simple asm code (only for an example - for point ... although it was possible to consider "Hello world" as well).
xor eax, eax
I do the following:
1. I compile to elf and look at the code section (opcodes are the same as x32):

nasm -f elf64 xor.s -o xor_x64
objdump -d xor_x64

2. Simple output of this "file to file" (default format is binary):
nasm -o bin_xor xor.s
hexdump bin_xor

I get this output:
86e912f35e734af3be7d720af6ff0def.png
Why did the byte 0x66 appear? Should the bytes in this section match what I got in the binary output? If not, why not?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question