flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Linux > Explain Like I'm 5: Segments in ELF files.

Author
Thread Post new topic Reply to topic
aaditmshah



Joined: 21 Apr 2013
Posts: 5
Location: Bloomington

Explain Like I'm 5: Segments in ELF files.

Consider the following hello world program:


Code:
format ELF64 executable 0
entry main

segment readable executable

main:
    mov rax1
    mov rdi1
    mov rsimsg
    mov rdxlen
    syscall

    mov rax60
    xor rdirdi
    syscall

segment readable writeable

msg db "Hello World!"10
len = $ - msg



What do the segment directives in this program do? I tried experimenting with it to understand what they do. First, I removed the executable permission flag from the first segment. To my surprise, the code still worked. Next, I removed the readable permission flag from the second segment and the code still worked. Finally, I removed both the segment directives and the code still worked fine.

So, what do these segment directive do? Explain like I'm 5.
Post 13 Mar 2018, 22:44
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2018, Tomasz Grysztar.
Powered by rwasa.