I wrote the following (fasm) assembly program:
format ELF64 executable segment readable executable ; sys_exit, sys_write, strlen and print are from io.inc and ; unistd64.inc at: https://github.com/pbohun/fasm-tutorials sys_exit = 60 sys_write = 1 entry main strlen: push rdi ; push to stack push rcx ; push to stack sub rcx, rcx ; set rcx to 0 mov rcx, -1 ; move -1 to rcx sub al, al ; set al to 0 cld ; clear the direction flags repne scasb ; repeat if not equal to al neg rcx ; negate rcx sub rcx, 1 ; subtract 1 from rcx mov rax, rcx ; move value from rcx to rax pop rcx ; restore original rcx value pop rdi ; restore original rdi value ret print: call strlen ; get string length mov rdx, rax ; move string length to rdx mov rsi, rdi ; move address of string to rdi mov rdi, 1 ; stdout mov rax, sys_write syscall ret main: mov rdi, msg call print xor rdi, rdi mov rax, sys_exit syscall segment readable msg db "This is a message.", 0xA, 0
When I disassemble with IDA Pro, under the segments I see this:
My question is, why are both segments called LOAD? What is the meaning behind this? I did not name the segments in my program.