[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] ELF
Peter,
in your „I talk to myself“ - discussion, you basically miss the point.
ELF and a.out formats aren’t fundamentally different. It’s the Atari loader format (enforced by the Atari OS regardless of whether it’s MiNT or plain TOS) that is.
gcc (GNU ld to be exact) by default generates all executables linked to be executed from the same absolute address. TOS does not provide the luxury of an execution environment where multiple executables can run from the same (virtual) address at once (as modern OS do). The Pexec() system call loads an executable to an arbitrary address and needs to provide means to allow the program to run from there. For this to work, TOS executables are basically linked to a start address of 0x0, but keep a table of absolute offsets that allows TOS to relocate the binary to its actual load address at load time. This is what Pexec() does at program startup.
The a.out-mintprg target of the m68k-atari-mint toolchain isn’t really a.out. The above mentioned TOS relocation table functionality has just been added to the original a.out target because it was easiest to start from there. The same could be done to ELF targets, if somebody opted to do so.
Cheers,
Markus
> Am 19.03.2016 um 13:39 schrieb Peter Slegg <p.slegg@scubadivers.co.uk>:
>
> On Wed, 16 Mar 2016 21:21:22 , Peter Slegg <p.slegg@scubadivers.co.uk> wrote:
>
> While working my way through some Oracle tech debt I was pondering
> ELF some more.
>
> It's beyond my C skills but how about creating a test:
>
> 1. build a "Hello ELF World" app with gcc (static linked)
> 2. take the u-boot code (licences permitting) and create an app
> that can load an ELF app and execute it.
>
> This would avoid having to integrate with the kernel from the outset.
>
>
> Peter
>
> talking to myself again ;-)
>
>
>>
>>> Linux statically linked programs:
>>> http://eli.thegreenplace.net/2012/08/13/how-statically-linked-programs-run-on-linux/
>>>
>>> u-boot:
>>> http://git.denx.de/?p=u-boot.git;a=blob;f=common/cmd_efi.c;h=c76296e7259f6b8e5b40148e894a2f953ba0ffdb;hb=9dffa52da8f3fd23fe38ee184512b2a08678d933
>>>
>>> ELF FAQ:
>>> http://www.pix.net/software/bsdos/elf_faq.html
>>
>>
>>
>
>
>
>
>