I found some assembly code about "hello world", but I don't understand leaq L1(%rip), %rdi, why rip is used here?
.text
.globl _main
_main:
pushq %rbp
movq %rsp, %rbp
leaq L1(%rip), %rdi <--it's the first time that I found IP is directly used in code.
movq $0, %rax
callq printf
movq #0, %rax <-sorry, here shoud be $0
leaveq
retq
.data
L1: .string 'hello jason\n'
usually, I understand and often use the following style assembly code as url http://libra.cs.virginia.edu/~aaron/08-nasm/nasmexamples.html
global _main
extern _printf
section .text
_main:
push message
call _printf
add esp, 4
ret
message:
db 'Hello, World', 10, 0
therefore, I don't understand the first program, why %rip is used? it's very strange.