ebook img

Relocatable file format and method and apparatus for creating and loading same PDF

90 Pages·2013·3.81 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Relocatable file format and method and apparatus for creating and loading same

USO05764987A United States Patent [19] [11] Patent Number: 5,764,987 Eidt et a1. [45] Date of Patent: Jun. 9, 1998 [54] RELOCATABLE FILE FORMAT AND OTHER PUBLICATIONS METHOD AND APPARATUS FOR CREATING “IEEE Standard for Microprocessor Universal Format for AND LOADING SAME Object Modules (IEEE Std 695-1990)”. IEEE Computer Society (Feb. 29. 1991). [75] Inventors: Erik L. Eidt. Campbell; Alan W. Braga. et al.. “A Portable Linking Loader". Symposium on Lillich. Los Gatos. both of Calif. Trends and Applications 1976: Micro and Mini Systems. [73] Assignee: Apple Computer, Inc.. Cupertino. IEEE Computer Society (May 27. 1976). pp. 124-128. Calif. Presser. Leon. and White. John R.. “Linkers and Loaders”. ACM Computing Surveys (Sep. 1972). vol. 4. No. 3. pp. 149-167. [21] Appl. No.: 654,013 (List continued on next page.) [22] Filed: May 28, 1996 Primary Examiner—Daniel H. Pan Related U.S. Application Data Attorney Agent, or Firm—Fliesler. Dubb. Meyer & Lovejoy [57] ABSTRACT 163] Continuation of Ser. No. 212,153, Mar. 14, 1994, aban doned, which is a continuation-impart of Ser No. 35,750, Mar. 23, 1993. Relocation table entries in a executable object code ?le are interpreted as relocation instructions rather than as indi [5 1] 1m. (:1.6 ............................. .. G06F 9/44; G06F 12/02 vidual speci?cations for a particular respective relocatable [52] U.S. Cl. .......... .. 395/701; 395f/10; 395/712 information item. An abstract machine is provided for inter [5 3] Field of Search . ...................... .. 395/658. 375. preting the relocation instructions and performing various 395/42l.08. 157. 800. 775. 700. 601. 500. relocation operations and various control functions for the 183.14. 139. 412. 701. 200.61. 682. 200.79. abstract machine. in response to the relocation instructions. 868. 676. 684. 311. 826. 110. 710. 200.59. The abstract machine maintains certain variables containing 284. 830. 712. 650. 507. 404; 364/DIG. 1. information which is referenced and updated in response to DIG. 2; 340/825. 28 certain types of the relocation instructions. thereby obviating the need to include such information as part of each relo [5 6] References Cited cation instruction. Certain of the relocation instruction types can also specify a particular relocation operation to be U.S. PA’I'EN'I‘ DOCUMENTS performed on a run of n consecutive relocatable information 4,791,550 12/1988 Stevenson et a1. ................... .. 395/650 items. where n is speci?ed as part of the relocation instruc 4,881,168 11/1989 Imagami et a1. ...... .. 395/800 tion. Certain of these relocation instruction types also con 4,918,587 4/1990 Pechter et a1. .. 395/421.08 sider each information item as including two or more 4,924,515 5/1990 Matyas et a1. .... .. 380/25 individual relocations of the same or di?erent types to 5,175,856 12/1992 Van Dyke et a1. .. 395/700 perform. thus e?‘ectively specifying a run of n repetitions of 5,193,180 3/1993 Hastings ............ .. 395/575 a pattern of relocations. Other types of relocation instruc 5,291,601 3/1994 Sands ............ .. 395/700 tions are also made available. The ?le also contains a hashed 5,307,490 4/1994 Davison et a1. . 395/650 symbol export table and pattem-initialized data expansion 5,327,559 7/1994 Priven et a1. 395/700 instructions. 5,339,419 8/1994 Chanetal. .... .. 395/700 5,403,639 4/1995 Bdsan et a1. . 395/600 5,408,665 4/1995 Fitzgerald ............................. .. 395F700 58 Claims, 14 Drawing Sheets f 102 105 x 108 X DISK CPU MEMORY DRIVE 104/ 5,764,987 Page 2 OTHER PUBLICATIONS Proceedings of the 1986 International Conference on Indus trial Electronics. ConlIol and Instrumentation (Sep. 29. "The Concise Atari ST 68000 Programmer’s Reference 1986). vol. 2 of 2. pp. 839-844. Guide”. Glentop Publishers (Aug. 1986). pp. 2-20 - 2-27. “SCO® UN1X® Development System. Programmer‘s Ref ‘inter-Linkage Function Invocation Method". IBM Techni erence Manual vol. 1". SCO Open Systems Software (10 cal Disclosure Bulletin (Sep. 1992). vol. 35. No. 4B. pp. Dec. 1991).pp. 180-186. 294-299. 337.351-354.369-372. 44-49. “R6000 InfoExplorer”. Articles Published on CD-ROM: “EXE Format for 32-Bit Personal Computer Systems". IBM IBM Corporation. 1991. Articles entitled: a.out File Format; Technical Disclosure Bulletin (Sep. 1992). vol. 34. No. 3. Optional Auxiliary Header for the a.out File; Section Head pp. 363-365. ers for the a.out File; Raw Data Sections for the a.out File; Garitagoitia. JR. et al.. “Relocating Direct Linking Loader Special Data Sections for the a.out File; Relocation Infor for MCS-80 Microcomputer Series". Euromicro Newsletter mation for the a.out File; xcolih; ?lehdnh; reloch; scnhdrh; (1977). vol. 3. No. 3. pp. 22-28. loader.h. Kanai. et al.. “The Concept and Implementation of Standard Duncan. Ray. “Advanced OS/2 Programming”. Microsoft Object Module Format for Microprocessors (SYSROF-E)”. Press (1989). Appendix D. pp. 715-736. US. Patent Jun. 9, 1998 Sheet 1 of 14 5,764,987 102 105 / 1 JOHN DISK CPU MEMORY DRIVE 104/ FIG 1 [106 312 DATA SECTION 1 / READ/ /324 wRITE DATA SECTION 2 READ APPLICATION PROGRAM [304 ONLY HEADER 1 305 CODE SECTION 1 /308 303 DATA SECTION 1 /_m LOADER SECTION 1 / LIBRARY CONTAINER 315 HEADER 2 /318 CODE SECTION 2 / 320 314 DATA SECTION 2 /322 LOADER SECTION 2 / FIG. 3 US. Patent Jun. 9, 1998 Sheet 2 of 14 5,764,987 LOAD CONTAINER / 204 LOAD ENITIRE CONTAINER INTO READ ONLY MEMORY IF NOT ALREADY LOADED BY ANOTHER TASK /'205 ALLOCATE AND FILL READ\WRITE MEMORY FOR DATA AND PIDATA SECTION USING SECTION HEADERS AND SECTION DATA PORTIONS OF PRESENT CONTAINER; CREATE REGIONS TABLE FOR PRESENT CONTAINER, INDICATING VIRTUAL START ADDRESS FOR EACH SECTION i IN PRESENT CONTAINER [208 RESOLVE IMPORTS 2.14 ANY MORE LOADABLE SECTIONS? 210 /_ PERFORM RELOCATIONS ON NEXT SECTION [215 INCREMENT i FIG. 2 US. Patent Jun. 9, 1998 Sheet 3 of 14 5,764,987 208 ‘ RESOLVE IMPORTS , ANY ENTRIES 404 REMAINING IN TABLE OF IMPORT CONTAINER IDs? 405 / RECURSIVELY LOAD CONTAINER FOR NEXT IMPORT CONTAINER 408 ANY IMPORT SYMBOLS REMAINING FOR THIS IMPORTED CONTAINER? /4.10 FIND NEXT IMPORT SYMBOL NAME (FROM IMPORT SYMBOL TABLE OF IMPORTING CONTAINER) IN EXPORT SYMBOL TABLE OF IMPORTED CONTAINER CALCULATE VIRTUAL ADDRESS OF THIS SYMBOL AND STORE AS IMPORTS (1'). WHERE j 15 THE SYMBOL NUMBER AS SEEN BY THE IMPORTING CONTAINER [4.14 \-412 INCREMENT SYMBOL NUMBER j FIG. 4 US. Patent 5,764,987 Jun. 9, 1998 Sheet 4 of 14 ERROR CHECKING INITIALIZE ABSTRACT MACHINE VARIABLES ANY MORE RELOCATION INSTRUCTIONS IN THIS SECTION‘? [510 COPY CURRENT RELOCATION INSTRUCTIOIN [512 INCREMENT RELOC BY 2 BYTES 514 SWITCH OPCODE 515 520 I 51h 52A 524 525\ / com: DATA DESC oscz VTBL SYMR 534 II 53% 53m /532 [535 H525 DDAT SYMB 001s nus SECN DELTA I I I I I I 5401 54A 5441 54m RPT LABS LSYM LRPT LSECS DEFAULT 5491 550i FIG. 5 US. Patent Jun. 9, 1998 Sheet 6 0f 14 5,764,987 15 13 12 9 8 0 O 1 O SUBOP4 CNTQ RUN FIG. 7A 1 0 0 0 B12 DELTA FIG. 7B 15 13 12 9 8 0 O 1 1 SUBOP4 IDXQ GLP FIG. 7C 15 14 13 6 5 O O 0 W8 N6 DELTADATA FIG. 70 15 12 11 B 7 O 1 O 0 1 I4 CNTB RPT 28 27 26 25 O SUB O 1 0 OPC OFFSET26 FIG. 7F 28 27 2s 2s 22 21 o 01 1 SUB- CNT4- 011122 OPC FIG. 76‘ US. Patent Jun. 9, 1998 Sheet 7 0f 14 5,764,987 FIND NEXT IMPORT SYMBOL NAME (FROM IMPORT SYMBOL TABLE OF IMPORTING CONTAINER) IN EXPORT SYMBOL TABLE OF IMPORTED CONTAINER 410 COMPUTE THE HASHWORD VALUE /_802 FOR THE SYMBOL NAME e04 COMPUTE THE SLOT NUMBER / FOR THE EXPORT SYMBOL [805 FETCH THE CHAIN COUNT AND THE EXPORT CHAIN TABLE INDEX OF THE FIRST EXPORT CHAIN TABLE ENTRY FOR THE SLOT, USING THE HASH SLOT NUMBER AS AN INDEX INTO THE EXPORT SLOT TABLE [808 LOOP THROUGH THE EXPORT CHAIN TABLE STARTING FROM THE INDEX PREVIOUSLY FETCHED 8.10 DOES THE HASHWORD FOR THE CURRENT ENTRY MATCH THAT COMPUTED FOR THE DESIRED EXPORT SYMBOL’? /-B12 APPLY THE EXPORT CHAIN TABLE INDEX OF THAT HASHWORD TO THE EXPORT SYMBOL TABLE TO OBTAIN THE OFFSET TO THE EXPORT NAME'S TEXT IN LOADER STRING TABLE 814 DOES THE LOADER STRING TABLE NO ENTRY MATCH THE DESIRED EXPORT SYMBOL NAME‘? FIG. 8 US. Patent 5,764,987 Jun. 9, 1998 Sheet 8 of 14 ( XCOFF-TO-PEF) INITIALIZATION CONVERT SYMBOLS SORT PEF EXPORT SYMBOLS CONVERT RELOCATIONS TO PEF RELOCATION INSTRUCTIONS /910 PACK DATA /912 COMPUTE OFFSETS AND FILL HEADERS /-914 WRITE PEF FILE ( DONE ) FIG. 9

Description:
trial Electronics. ConlIol and Instrumentation . 9, 1998. Sheet 6 0f 14. 5,764,987. 15. 13 12. 9 8. 0. O 1 O SUBOP4. CNTQ. RUN. FIG. 7A. 1 0 0 0. B12.
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.