Page 1 of 1
Why does the Bare Bones tutorial use ELF?
Posted: Sat Jan 12, 2013 5:30 pm
by gsingh2011
The Bare Bones tutorial uses the ELF file format. What is the benefit of this as opposed to another format?
Re: Why does the Bare Bones tutorial use ELF?
Posted: Sat Jan 12, 2013 7:39 pm
by zhiayang
gsingh2011 wrote:The Bare Bones tutorial uses the ELF file format. What is the benefit of this as opposed to another format?
I may be wrong, and there may be more benefits than this.
1. ELF is widely supported. It provides a means of 'checking' the integrity (as secure a simple 4-byte magic header is) of the file.
2. It has debugging symbols, for example symbol tables, that enable debugging externally, and for doing a backtrace internally.
3. With the .dyn* and .reloc sections, it can make dynamic loading much simpler.
I suggest searching for these things on google. We are not here to answer your simple questions. Please, at least post some findings or other things.
Re: Why does the Bare Bones tutorial use ELF?
Posted: Sat Jan 12, 2013 7:44 pm
by gsingh2011
Googling gives me a description of the format, but not why one would use this format over another. And why someone use this format for OSDev might be a different answer than using the format for an executable. But thanks for your input. If anyone has any other benefits of using ELF, I'd like to know.
Re: Why does the Bare Bones tutorial use ELF?
Posted: Sat Jan 12, 2013 7:59 pm
by zhiayang
gsingh2011 wrote:Googling gives me a description of the format, but not why one would use this format over another. And why someone use this format for OSDev might be a different answer than using the format for an executable. But thanks for your input. If anyone has any other benefits of using ELF, I'd like to know.
The third benefit doesn't really apply for the actual OS executable, but rather for programs that you might load *from* your OS, later on.
1. ELF is widely supported. *MAYBE*, you might be able to run a linux program on your OS, if you provide all the system calls and libraries it needs, without re-compiling, IF your OS is fully POSIX compliant.
2. Again, debugging and backtracking is very valuable in OSDev to determine where your OS went wrong.
Re: Why does the Bare Bones tutorial use ELF?
Posted: Sat Jan 12, 2013 8:29 pm
by gravaera
Yo:
requimrar wrote:I suggest searching for these things on google. We are not here to answer your simple questions (?). Please, at least post some findings or other things.
I feel as if this post was completely unedifying, useless, tasteless, and laced with condescension.
@OP:
From a purely practical point of view, we recommend ELF for several reasons:
- In the PE/COFF specification, you will find in the legal preamble, clauses which limit the use of PE that may apply to competing products such as kernels. I do not remember exactly what the clause was, or why I felt that it clashed with the aim of using PE for competing kernel development, but when I read it, it was fairly obvious that the clause did clash.
- There is a subtle (and imho, healthy) bias toward a mostly Unix/POSIX development environment for all documentation on the site.
- The majority of GNU compiler stack programs and accompanying tools very seamlessly work with ELF.
- The majority of people in the community use ELF.
- The majority of the documentation you will find publicly available will be POSIX/GNU biased: you'll encounter a lot of documentation on Linux when trying to do research on a lot of topics.
The first point may or may not be one of the most significant reasons for ELF being used on the wiki, but whether or not it was, I'd like to suggest that you make it one of your foremost considerations when choosing your own format.
--Peace out,
gravaera
Re: Why does the Bare Bones tutorial use ELF?
Posted: Sat Jan 12, 2013 10:14 pm
by Owen
Additionally, the Bare Bones tutorials are designed to work with GNU GRUB. GRUB expects you to use ELF; using other formats uses a mechanism which is defined by the Multiboot specification itself to be a kludge.