What’s difference between number with $ or without $ symbol in at&t assembly syntax?

The difference is that with $ it’s the numeric value while without $ it’s the contents of memory at that address If argument of instruction is without any special marker (such as % for register or $ for numeric constant), then it is memory access. So following: movl 10, %eax movl foo, %eax Corresponds to … Read more

Why use LDR over MOV (or vice versa) in ARM assembly?

It is a trick/shortcut. say for example ldr r0,=main what would happen is the assembler would allocate a data word, near the instruction but outside the instruction path ldr r0,main_addr … b somewhere main_addr: .data main Now expand that trick to constants/immediates, esp those that cannot fit into a move immediate instruction: top: add r1,r2,r3 … Read more