Re: Object file creation and linking...

Paul Robinson <TDARCOS@MCIMAIL.COM>
Sun, 29 Aug 1993 13:50:56 GMT

          From comp.compilers

Related articles
Object file creation and linking... dnebing@andy.bgsu.edu (1993-08-26)
Re: Object file creation and linking... TDARCOS@MCIMAIL.COM (Paul Robinson) (1993-08-29)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Paul Robinson <TDARCOS@MCIMAIL.COM>
Keywords: linker
Organization: Tansin A. Darcos & Company, Silver Spring, MD USA
Date: Sun, 29 Aug 1993 13:50:56 GMT

Dave Nebinger <dnebing@andy.bgsu.edu>, writes:


> After attacking our campus libraries online search system,
> I was depressed to find that there weren't any references to
> the generation of object files and the subsequent linking
> process.


In the book of "The Andromeda Strain," Dr. Michael Chricton mentions
that in the physical sciences, biology is the "retarded child" that
is always left lagging.


Well, in the field of compilers, "object files" are the "retarded child"
that nobody really does much of anything about.


Probably the simplest format for object files used was the
ESD/TXT/RLD/ISD/END card format designed by IBM for the 360 series of
computers. ESD records define a CSECT or "Control Section" (Main Program,
Subroutine, Procedure and Function names), or an entry point (Named or
Blank Common and Entry names), TXT records contain machine code, and RLD
records indicate which spots in the machine code represent external
addresses. It isn't very complicated and it does a nice job where you
have simple relocation and not very complicated external features. There
is also an optional ISD record which is used to create debugging points.
And the END card indicates the end of the module and optionally the entry
point for the module.


Each record is exactly 80 bytes in length, begins with a hexadecimal 02,
and the 3 letter code (in EBCDIC) appears at positions 4-6. The rest
of the record has fixed formats depending on what card is being created.


The object format for RT11 on the PDP-11 is much richer in capability and
much more complicated. Where the 360 object code allows you to simply
indicate an external point is referenced in a module, and these 1, 2, 3 or
4 bytes are the location I am using for the address (depending on how you
wanted the relocation marked), the object file format for RT11 allowed you
to add and subtract one external address from another, and I think you
could even multiply and divide external addresses. I suppose you could
use it to create tables and things, I suppose, e.g. if you take the
address of a table which is global to the program, subtract start from
end, and you know how long the table is. If the table size is
indeterminant, you could define an entry indicating the length of one
entry; divide that value by the size of the table and you would have the
number of entries in the table created as a value in your program, all of
this being done automatically by the linker without having to hard code
table sizes in the program.


MS-DOS uses a changed version of the Intel Object Specification for an
.OBJ file stored under it. Some of the features not used include the
dynamically relocatable CSECT (MS-DOS uses .EXE files for that). The
format of .OBJ files under MS-DOS is very complicated, in my opinion. I
still have some trouble figuring it out.


I have a copy of a file that I downloaded from somewhere that describes
the method used for creating object files under MS-DOS. If someone wants
a copy, write me and I'll E-Mail it. If there's a lot of interest, I'll
find an FTP site for it.


---
Paul Robinson - TDARCOS@MCIMAIL.COM
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.