[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Redpill me on e_entry

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 18
Thread images: 4

File: entry.png (2KB, 600x400px) Image search: [Google]
entry.png
2KB, 600x400px
I'm studying the ELF format and can't grasp one structure field: e_entry. What does it mean? What is it for? Does it load the whole ELF file there or just the .text section? If everything is in virtual memory anyway, why is the point of it?

Just before you ask, I was born in 1997, I don't know anything about operating systems and how do they deal and dealt with memory, I just want to learn the ELF format so I could make my own compiler. I'm not interested in making my own operating system at the moment.
>>
File: 1497220879992.jpg (3MB, 4896x3672px) Image search: [Google]
1497220879992.jpg
3MB, 4896x3672px
Leave this Linus shit behind you and join the red sea
>>
>>60895600
ELF is not OS-specific.
>>
>>60895567
It's the program's entry point, where it begins to execute the code once it's loaded into memory.
>>
>>60895638
Is it there just to make the jump offsets in .text correct? And load linker symbols correctly too?
>>
>>60895600
he didn't mention linux
elf is used in lots of places, even the playstation 2 uses it
>>
>2010 + x
>not using l337 constants

>32-bit constant
>0xB16B00B5

>MAC spoofing
>13A7D3ADBEEF
>>
>>60895666
Yes, and that's because the PS2 also runs Linux
>>
>>60895911
It does not.
>>
>>60895658
it's there so you are able to start the program you idiot
>>
>>60895963
Am I correct so far?
# ELF32 header (52 bytes)
7F 45 4C 46 # signature
01 01 01 00 # ELFCLASS32, ELF2LSB, EV_CURRENT (file version), ELFOSABI_NONE
00 00 00 00 00 00 00 00 # padding
02 00 # executable
03 00 # for Intel 80386 (also known as x86, x86-32 and IA-32)
01 00 00 00 # object file version (EV_CURRENT)
08 04 80 00 # entry point (where the whole ELF file is loaded or _start???)
34 00 00 00 # program header offset: right after ELF header, 52 bytes)
00 00 00 00 # section header offset: no section headers
00 00 00 00 # The Intel386 architecture defines no flags; so this is 0.
34 00 # ELF header size (52 bytes)
20 00 # Program header size (32 bytes)
10 00 # Program header section number
00 00 # e_shentsize
00 00 # e_shnum
00 00 # e_shstrndx

# Program header for ELF32 (32 bytes)
10 00 00 00 # Loadable program segment
00 00 00 00 # Offset of that segment
08 04 80 00 # p_vaddr
08 04 80 00 # p_paddr
?? ?? ?? ?? # file size (don't know yet)
?? ?? ?? ?? # memory size (same as file size)
05 00 00 00 # p_flags
00 10 00 00 # p_align = 4096 bytes
>>
>>60896007
Also, I think that what the OS actually loads is specified in the program header table.

p_type says that this segment the OS will have to load
p_off says the FILE offset that specifies the segment start
p_vaddr says the virtual address of that segment
p_paddr says the actual memory address of that segment

Oh, and I get it now, e_entry says where in the loaded segments to start the execution! I think I get it now, so atm the file is wrong, because I haven't written my _start yet and e_entry will point to that + p_vaddr or p_paddr, don't know yet.

So, at the moment e_entry, p_vaddr and p_paddr are all wrong, but I know how to fix them.
>>
>>60896007
the entry point is where execution starts, the OS processes the ELF, load dynamic librarys etc. and once it's done execution jumps to that address.
>>
>>60896213
Thanks, you explained it well, I understand it now.
>>
>>60895926
>>60895911
it can, but it doesn't while playing ps2 games
>>
>>60895567
There's nothing to redpill about, you meming faggot.
It's the entry point to the program, nothing else.
>>
File: 1482710349278.png (4KB, 334x24px) Image search: [Google]
1482710349278.png
4KB, 334x24px
>>60895681
>>0xB16B00B5
I'm using this one in my kernel.
>>
File: a.png (10KB, 256x134px) Image search: [Google]
a.png
10KB, 256x134px
>>60895681
Thread posts: 18
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.