Live data from Hacker News

On ELF, Part 2 (2018)

kestrelcomputer.github.io

31–36 of 36 posts

Re: On ELF, Part 2 (2018)

#32
post #6

I worked with a.out on early unixes and elf on later ones - not addressed here is the main reason for switching: ELF allowed you manage pages contiguously on disk so that they could be paged in directly (stuff can be page aligned within the file at it's natural offsets), while a.out was designed for swapped kernels where you would just read() data into a text section, address 0 might be 32 bytes from the start of a f…

What’s the advantage of that? Would the kernel just load the entire file into contiguous memory and set up pages at the correct physical addresses?

Map the file into memory, but not actually load it, just set up the mapping and wait until it's used to pagefault it in.

Re: On ELF, Part 2 (2018)

#34
post #6

I worked with a.out on early unixes and elf on later ones - not addressed here is the main reason for switching: ELF allowed you manage pages contiguously on disk so that they could be paged in directly (stuff can be page aligned within the file at it's natural offsets), while a.out was designed for swapped kernels where you would just read() data into a text section, address 0 might be 32 bytes from the start of a f…

Although Aix went the Windows way with XCOFF instead of ELF.

It is a kind of funny feeling to deal with import libraries and definition files on an UNIX.

Re: On ELF, Part 2 (2018)

#35
post #6

I worked with a.out on early unixes and elf on later ones - not addressed here is the main reason for switching: ELF allowed you manage pages contiguously on disk so that they could be paged in directly (stuff can be page aligned within the file at it's natural offsets), while a.out was designed for swapped kernels where you would just read() data into a text section, address 0 might be 32 bytes from the start of a f…

What’s the advantage of that? Would the kernel just load the entire file into contiguous memory and set up pages at the correct physical addresses?

That's what we did on the old swap based systems, on modern paged systems we don't read pages in untill there is a page fault, to do that efficiently we need to align page boundaries with disk block boundaries - elf (and coff before it) allowed you to do this while a.out doesn't
Post reply on HN