ActivityMonitoringAnalysis ApplicationChain CInputOutputLibrary DistributedFaultTolerance DynamicProgramming EclipseUMLConcepts GridComputing L01SmartSitePublishing L02SmartSitePublishing L03SmartSitePublishing L04SmartSitePublishing LinuxResources ModelDrivenTransformation ObjectFileFormat ProcessDocumentation ProductDataManagement SoftwareDebugging_1 SoftwareDebugging_2 WhatIsCORBA AutovalTraining.pdf IAmALightPole.pdf stf-r-abstraction.pdf |
IntroductionAlmost all systems use an object file of some form or another to represent executable machine code for the system. Further most systems provide a means of excecuting object code. Through out this seminar object file is used to refer to both an object file as well as an executable file. An object file is often produced by one tool or system and consumed or used by a different tool or system. Producers of object files include compilers assemblers and linkers. Consumers include the operating system link/loader, archiver or librarian, debuggers and other utilities. In this seminar we will discuss many of the following questions:
What Is An Object File Format ?The fact that an object file is produced and consumed by different tools implies that an object file should be in a standard pre-determined format for various tools to generate the object file and other tools to read and understand the contents of the object file. An Object File Format refers exactly to such a predetermined object file format standard.A Simple Object FileBefore asking more questions let us look at a simple object file format. On MSDOS systems files ending with the .bin or .com extension often refer to executable file formats. These are simple executable files that just contain a program in machine code and almost no other information. This is a trivial example of an object file format. A typical loader just reads the file into memory and passes execution control to the first address of the file.Who produces object file formats ?Compilers (code generators) some time generate object files. Assemblers convert assembly files to object files. Linkers link together object files into executable files or other object files.Who Uses An Object File and Why ?The Operating System loader loads object files into main memory to enable execution of the program. A debugger uses object files to enable users monitor and control the execution of a program. A linker links together different object files into a single executable file. An archiver or librarian creates a single library or archive of object files. Other tools like nm use object files to print out the contents of the symbol table in a human readable form. Some other tools like prnieee and dis can be used to view the contents of an object file in a human readable and/or dis-assembled form. Tools like strip and mcs can be used to selectively remove contents of an object file.What does an object file contain ?An object file contains all or some of the following information: [General Information] File Format Type (Magic Number -- look at /etc/magic) Processor Type For Which Code Is Generated [Program Image] Size and start of executable code. Executable code. Size and start of initialized data. Initialized data. Size and start of uninitialized data. [Symbol Table] External Definitions External References Relocation information. [For linking] Type information. [Debug information] Line number information.[Debug information] Comments. How is an object file organized ?An object file is often organized into several sections, each section containing a specific type of information. Often object files may contain more than one section containing similar information. For example, there can exist multiple sections all containing data. Here is one possible organization: Section Table : Section Name: Section Start (in file): Section Size Section 1. Section 2. ... Section n. Here section 1 could be code, section 2 data, section 3 reloc. information, section 4 type information, section 5 line number information etc.,.What are some of the object file formats ?
Why are there some so many object file formats ?
|