When looking at a listing file that was generated by NASM, I see that there are three kinds of opcodes:
They're showing where relocations will be applied at link time.
[nnnnnnnn]
shows an absolute relocation (when the linker performs the relocation, the base address of some section will be added to the offset). e.g. once the binary is fully linked, those bytes in the push str2
instruction will be changed to contain the base address of .data
+ 0x09
.
(nnnnnnnn)
shows a PC-relative relocation (used for calls and branches, where the final value must be relative to the address of the next instruction). e.g. the bytes in the call func2
instruction will be updated with the difference between the final address of func2
, and the address of the following instruction (call func3
).
There are no brackets for the call func3
instruction itself because no relocation is needed in that case - the call
instruction needs a relative address, but func3
is within the same section, so the relative address is already known (the following instruction is at .text + 0x21
, and func3
is at .text + 0x2c
, so the relative address is 0xb
regardless of the final address of .text
).