ВК
Сейчас для интереса под NASM перепишу и скину
Size: a a a
ВК
s
rel, если я правильно помню, он с ним как раз rip-relative адресацию и делает.ВК
global main
section .rodata
hello_world: db "Hello, world!", 0xA, 0x0
hello_world_length equ $-hello_world
section .text
main:
mov rax, 0x1
mov rdi, 0x1
mov rsi, hello_world
mov rdx, hello_world_length
syscall
mov eax, 0x3c
mov rdi, 0x0
syscall
nasm -f elf64 -g -F dwarf hello_world_64.S -o hello_world.ogcc hello_world.o -o hello_world$ gdb hello_world
Reading symbols from hello_world...
(gdb) b main
Breakpoint 1 at 0x1130: file hello_world_64.S, line 10.
(gdb) run
Starting program: /home/bomber/MyFiles/Programming/Assembler/hello_world
Breakpoint 1, main () at hello_world_64.S:10
10 mov rax, 0x1
(gdb) x/1i $pc
=> 0x555555555130 <main>: mov $0x1,%eax
Breakpoint 1 at 0x11300x555555555130ВК
s
global main
section .rodata
hello_world: db "Hello, world!", 0xA, 0x0
hello_world_length equ $-hello_world
section .text
main:
mov rax, 0x1
mov rdi, 0x1
mov rsi, hello_world
mov rdx, hello_world_length
syscall
mov eax, 0x3c
mov rdi, 0x0
syscall
nasm -f elf64 -g -F dwarf hello_world_64.S -o hello_world.ogcc hello_world.o -o hello_world$ gdb hello_world
Reading symbols from hello_world...
(gdb) b main
Breakpoint 1 at 0x1130: file hello_world_64.S, line 10.
(gdb) run
Starting program: /home/bomber/MyFiles/Programming/Assembler/hello_world
Breakpoint 1, main () at hello_world_64.S:10
10 mov rax, 0x1
(gdb) x/1i $pc
=> 0x555555555130 <main>: mov $0x1,%eax
Breakpoint 1 at 0x11300x555555555130mov eax,dword[hello_world], тогда появятся проблемы.LW
global main
section .rodata
hello_world: db "Hello, world!", 0xA, 0x0
hello_world_length equ $-hello_world
section .text
main:
mov rax, 0x1
mov rdi, 0x1
mov rsi, hello_world
mov rdx, hello_world_length
syscall
mov eax, 0x3c
mov rdi, 0x0
syscall
nasm -f elf64 -g -F dwarf hello_world_64.S -o hello_world.ogcc hello_world.o -o hello_world$ gdb hello_world
Reading symbols from hello_world...
(gdb) b main
Breakpoint 1 at 0x1130: file hello_world_64.S, line 10.
(gdb) run
Starting program: /home/bomber/MyFiles/Programming/Assembler/hello_world
Breakpoint 1, main () at hello_world_64.S:10
10 mov rax, 0x1
(gdb) x/1i $pc
=> 0x555555555130 <main>: mov $0x1,%eax
Breakpoint 1 at 0x11300x555555555130LW
t
A
ВК
global main
section .rodata
hello_world: db "Hello, world!", 0xA, 0x0
hello_world_length equ $-hello_world
section .text
main:
mov rax, 0x1
mov rdi, 0x1
mov rsi, hello_world
mov rdx, hello_world_length
syscall
mov eax, 0x3c
mov rdi, 0x0
syscall
nasm -f elf64 -g -F dwarf hello_world_64.S -o hello_world.ogcc hello_world.o -o hello_world$ gdb hello_world
Reading symbols from hello_world...
(gdb) b main
Breakpoint 1 at 0x1130: file hello_world_64.S, line 10.
(gdb) run
Starting program: /home/bomber/MyFiles/Programming/Assembler/hello_world
Breakpoint 1, main () at hello_world_64.S:10
10 mov rax, 0x1
(gdb) x/1i $pc
=> 0x555555555130 <main>: mov $0x1,%eax
Breakpoint 1 at 0x11300x555555555130gdb -ex 'set disable-randomization off' hello_worldВК
mov eax,dword[hello_world], тогда появятся проблемы.mov rsi, [hello_world] конструкции уже ругань на несовместимый с PIE кодlea rsi, [rel hello_world]
mov rsi, [rsi]
LW
s
mov rsi, [hello_world] конструкции уже ругань на несовместимый с PIE кодlea rsi, [rel hello_world]
mov rsi, [rsi]