1

The usage of this is that I saw after used gcc -S.

I know ary represents the first address of the sequence, then I also know leaq ary(, %rdi, 4) has the same effect(assume %rdi equals 0).

But I don't understand, why can ary(%rip) access data section. Maybe I lack the memory layout for program running, or I misunderstand the addressing modes?

Below is my example.

.section .data
ary:
    .int 1, 2, 3, 4, 5, 6

.section .text
.globl  _start

_start:
    leaq ary, %rax
    leaq ary(%rip), %rbx   # ???

    movq $60, %rax
    syscall
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
OnlyWick
  • 342
  • 2
  • 10

0 Answers0