Path: utzoo!utgpu!attcan!uunet!husc6!think!ames!elroy!gryphon!desint!geoff From: geoff@desint.UUCP (Geoff Kuenning) Newsgroups: comp.sys.next Subject: Re: portable a.out formats Message-ID: <1805@desint.UUCP> Date: 21 Oct 88 05:46:17 GMT References: <909@goofy.megatest.UUCP> <23314@amdcad.AMD.COM> Reply-To: geoff@desint.UUCP (Geoff Kuenning) Organization: Interrupt Technology Corp., Manhattan Beach, CA Lines: 28 In article <23314@amdcad.AMD.COM> tim@crackle.amd.com (Tim Olson) writes: > It is very hard to create a truly portable object file format that can > work on all machines. The problem is the relocation info... > ... > Now we need a relocation type that can take a 32-bit absolute address > and stuff the upper half into an instruction. > > Because of this, most vendors extend a.out or COFF to fit their > requirements. A fully portable object file format would require a > general-purpose linker "evaluation language" which allows not only +/-, > but also <<, >>, &, |, etc. And a lot of linkers have this. Check out the DEC linkers, for example, if I remember correctly. It's not very hard to implement a stack machine that can load from and store to arbitrary places in the object file or the linked image. The real advantage of such a linker is not portability, but the fact that you are no longer restricted in the sort of link-time expressions you can use in your code. For example, you could write: int number_of_shorts = ((int) &a - (int) &b) / 2; (Admittedly a contrived and stupid example, but when you *really* need to do such a thing, it's a pain to have the linker prohibit it). -- Geoff Kuenning geoff@ITcorp.com uunet!desint!geoff