Path: utzoo!utgpu!attcan!uunet!ncrlnk!ncrcae!ece-csc!mcnc!gatech!emcard!mat From: mat@emcard.UUCP (Mat Waites) Newsgroups: comp.sys.cbm Subject: Re: Power-C Linker Format Message-ID: <6146@emcard.UUCP> Date: 7 Nov 88 14:09:27 GMT References: <6219@pogo.GPID.TEK.COM> Reply-To: mat@emcard.UUCP (Mat Waites) Organization: Emory University Cardiac Data Bank Lines: 132 In response to a request for C-power object file format, here is a posting from Frank Prindle from a while back: ------------------------- From gatech!prindle Wed May 11 14:54:31 EDT 1988 Status: RO Here is, as I recall it, the format of a C Power (AKA Power C) relocatable object (i.e. a ".o" or ".obj") file; others, please correct me if this is wrong, though I checked it out with the C Power assembler (ASSM) source code and the C Power reverse assembler (RA) source code: There are 5 distinct parts to the object file; each part begins with a 2 byte count in standard 6502 low-byte/hi-byte format. The 5 parts directly follow each other in the following order: 1. relocatable object code 2. relocation entries 3. external definition entries 4. external reference entries 5. uninitialized data block entries I will describe each part in detail: 1. relocatable object code: The first 2 bytes are a byte count of the object code to follow. What follows is simply the generated object code for the corresponding source code file. For those instructions and .byte or .word pseudo ops which reference relocatable addresses within a function (typically for local jumps), the value in the operand field is the offset relative to the first word of object code. For those instructions and .byte or .word pseudo ops which reference externally defined addresses, the value of the operand field is irrelevant and typically filled in by the compiler with bytes which duplicate the byte which immediately preceeds them. This part ends when the number of bytes of object code specified in the count have been encountered. 2. relocation entries: The first 2 bytes are a count of the number of relocation entries to follow. Each relocation entry is exactly 2 bytes long and consists of an offset relative to the first byte of object code. This offset actually points to the byte before a 2-byte address which is to have added to it the absolute address of the first word of object code; that is, for 3-byte instructions, this offset points to the op-code preceed- ing an address to be relocated; for 2-byte addresses without an op-code (e.g. .word pseudo ops), the offset points to the byte before the address to be relocated. 1-byte addresses to be relocated (e.g. >addr or