From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <7871fcf50802180853v7473d507w991517014e3cb4bb@mail.gmail.com> Date: Mon, 18 Feb 2008 11:53:32 -0500 From: "Joel C. Salomon" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Page-aligned executables (Was re: [9fans] Non-stack-based calling conventions) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Topicbox-Message-UUID: 5958d682-ead3-11e9-9d60-3106f5b1d025 On Feb 18, 2008 3:38 AM, Anant Narayanan wrote: > Just as an observation (may not be related to the thread), all the > executable file formats that Linux currently supports, have page- > aligned sections in the file! (Now I know why hexdump always shows me > a bunch of zeros in-between). > > That means, all the loader really does is mmap the sections into the > right memory locations. What next, maybe also put in the BSS in the > file so you wouldn't have to allocate that either ;) Ron mentioned that tidbit in his IWP9 talk about booting Plan 9 under lguest. Lguest (or was it another virtualizer?) uses mmap so it can load any arbitrary number of client kernels; 9l-produced ELF files break that model. > Hence, writing the loader for Plan 9's a.out proved to be a challenge. > > I ended up writing a user-space program that padded out the required > gap between TEXT and DATA before asking the kernel to execute it. > Suboptimal, but it works. > > If anyone has any ideas as to how I can improve the situation, i'll be > grateful. What's the context that you're building this loader for? --Joel