JPH0659903A - Relocatable assembling system - Google Patents

Relocatable assembling system

Info

Publication number
JPH0659903A
JPH0659903A JP20988292A JP20988292A JPH0659903A JP H0659903 A JPH0659903 A JP H0659903A JP 20988292 A JP20988292 A JP 20988292A JP 20988292 A JP20988292 A JP 20988292A JP H0659903 A JPH0659903 A JP H0659903A
Authority
JP
Japan
Prior art keywords
symbol
machine language
processing
information
assembler
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP20988292A
Other languages
Japanese (ja)
Inventor
Eiichi Matsumoto
栄一 松本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC IC Microcomputer Systems Co Ltd
Original Assignee
NEC IC Microcomputer Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC IC Microcomputer Systems Co Ltd filed Critical NEC IC Microcomputer Systems Co Ltd
Priority to JP20988292A priority Critical patent/JPH0659903A/en
Publication of JPH0659903A publication Critical patent/JPH0659903A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To improve a processing speed by changing allocation especially in a solving method for the reference of positional information of another machine word in a source program for a computer in the transfer of information between an assembler and a linker in a relocatable assembling system. CONSTITUTION:The system has an assembler body 110 for forming a final machine word 130 and outputting the formed machine word 130 to an object module only when a sentence for referring the positional information of another machine word appears in a source program 100 and the value of the positional information referred prior to the appearance of the sentence has been settled, and when the value is not settled yet, outputting an unsettled machine word having a margin capable of filling an unfixed part thereafter and correcting information 140 for the position of the unsettled machine word and a linker body 160 for inputting plural object modules and solving mutual reference relation in each object module prior to the solution of mutual reference relation among programs and the processing speed is improved by completing processing in the body 110 only by once.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明はリロケータブル・アセン
ブル・システムに関し、特にそのシステムのアセンブラ
とリンカとの情報の受渡しに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a relocatable assemble system, and more particularly to passing information between an assembler and a linker of the system.

【0002】[0002]

【従来の技術】現在、機械語の機械語文法によるプログ
ラム開発方法としては、開発の容易性を向上させるた
め、計算機の機械語命令の中でメモリ中の特定の位置に
対する読出しや書込み及びプログラムの実行位置の変更
を行う機械語を記述する際に、実際の位置を具体的数値
で示す代りに名前(以下シンボルという)を付けて記述
する方法と、1つのプログラムを複数のファイルに分割
して記述することにより、機能を分割して記述したり標
準的な処理機能を部品化して何度も使用することで設計
の効率化を促すリロケータブル・アセンブル・システム
が一般的になっている。
2. Description of the Related Art Currently, as a program development method using a machine language grammar of a machine language, in order to improve the easiness of development, in a machine language instruction of a computer, reading and writing to a specific position in a memory and a program When writing a machine language to change the execution position, give a name (hereinafter referred to as a symbol) instead of indicating the actual position with a specific numerical value, and divide one program into multiple files. A relocatable assemble system that promotes design efficiency by describing functions by dividing them and describing standard processing functions as parts and using them many times has become common.

【0003】この機能を実現するための従来のリロケー
タブル・アセンブル・システムは、アセンブラにおいて
原始プログラムから未確定機械語本体と、未確定機械語
を確定させるための修正情報と、シンボルと実際の位置
との対応表(以下シンボル・テーブルという)とをオブ
ジェクト・モジュールに出力し、リンカにおいてはその
オブジェクト・モジュールを複数入力し相互のシンボル
・テーブルと修正情報とを参照して未確定機械語をロー
ド・モジュールとして完成していた。
A conventional relocatable assemble system for realizing this function is a assembler that includes an undetermined machine language body from a source program, correction information for determining an undetermined machine language, a symbol, and an actual position. And the corresponding table (hereinafter referred to as the symbol table) are output to the object module. In the linker, multiple object modules are input and the undefined machine language is loaded by referring to the mutual symbol table and modification information. It was completed as a module.

【0004】図4は、従来のリロケータブル・アセンブ
ル・システムの基本形を示す流れ図である。アセンブラ
本体110はパス1処理121とパス2処理122で構
成されている。パス1処理121では原始プログラム1
00を読み込みながらその内容を解析し、原始プログラ
ム内で現れるシンボルとその実際の位置との対応表を作
成する。次に、パス2処理122で再度同じ原始プログ
ラム100を読み込みながら上記の対応表を参照しなが
ら機械語本体131をオブジェクト・モジュールとして
出力する。
FIG. 4 is a flow chart showing the basic form of a conventional relocatable assemble system. The assembler body 110 is composed of a pass 1 process 121 and a pass 2 process 122. Source program 1 in pass 1 processing 121
While reading 00, the contents are analyzed and a correspondence table between the symbols appearing in the source program and their actual positions is created. Next, in the pass 2 processing 122, the same source program 100 is read again and the machine language body 131 is output as an object module while referring to the above correspondence table.

【0005】このようにアセンブラ本体110が原始プ
ログラム100を2度読み直しする理由は、原始プログ
ラム100でのシンボルの参照が、シンボルの定義より
先に現れる場合がある事による。さらに一般のリロケー
タブル・アセンブル・システムでは、1つのプログラム
を複数のファイルに分割して作成する機能を有するた
め、別の原始プログラム内から参照される可能性のある
シンボルとその実際の位置との対応表としてシンボル・
テーブル151と、逆に現在アセンブル中の原始プログ
ラムから別の原始プログラムを参照している場合はアセ
ンブラ本体ではそのシンボルの実際の位置を決定できな
いため、次の処理であるリンカに対して機械語本体13
1内の何処の機械語がまだ確定していないか、及びどう
いうシンボルを参照しているかを記述した修正情報14
1を出力する。
The reason why the assembler body 110 rereads the source program 100 twice in this way is that the reference of the symbol in the source program 100 may appear earlier than the definition of the symbol. Furthermore, since a general relocatable assemble system has a function to create one program by dividing it into multiple files, the correspondence between symbols that may be referenced from within another source program and their actual positions. Symbol as table
On the contrary to the table 151, if the source program currently being assembled refers to another source program, the assembler body cannot determine the actual position of the symbol, so the machine language body is sent to the linker, which is the next process. Thirteen
Modification information 14 that describes where the machine language in 1 is not yet determined and what symbol is referred to
1 is output.

【0006】この例では、機械語本体131と修正情報
141とシンボル・テーブル151とをまとめてオブジ
ェクト・モジュールと称して説明している。
In this example, the machine language body 131, the modification information 141, and the symbol table 151 are collectively referred to as an object module for description.

【0007】さらに、リンカ本体160は、上記の手順
で作られた複数のオブジェクトを入力し、機械語を結合
して機械語間の相互参照の解決を行い、その結果をロー
ド・モジュール210として出力する。その処理の動作
を以下に示す。
Further, the linker main body 160 inputs a plurality of objects created by the above procedure, combines machine words to resolve cross references between machine words, and outputs the result as a load module 210. To do. The operation of the process is shown below.

【0008】リンカ本体160は、最初のオブジェクト
の読込み処理171を行った後に、予め指定されたその
他のオブジェクトに対して、次のオブジェクトの読み込
み処理172を実行しながら、その都度既に読込まれた
オブジェクトとの相互参照を解決するためオブジェクト
間の相互参照の解決処理191を実行し、その一連の処
理を全てのオブジェクトに対して繰り返す。処理完了の
判断200はその処理を全てのオブジェクトに対して繰
り返す事を制御するための判断処理である。
The linker main body 160 executes the reading process 171 of the first object, and then executes the reading process 172 of the next object with respect to other objects designated in advance. The inter-object cross-reference resolution processing 191 is executed to resolve the cross-reference with and the series of processing is repeated for all the objects. The process completion determination 200 is a determination process for controlling that the process is repeated for all objects.

【0009】[0009]

【発明が解決しようとする課題】前述した従来のリロケ
ータブル・アセンブラ・システムにおいては、説明した
ようにアセンブラ本体で原始プログラムを2度読み込む
必要があるため、ファイルの読出し時間が重複してかか
り、また読むたびに構文解析処理を行うので処理時間が
重複し、処理速度が遅いという欠点があった。
In the above-described conventional relocatable assembler system, since it is necessary to read the source program twice by the assembler body as described above, it takes a long time to read the file. Since the parsing process is performed every time it is read, there is a drawback that the processing time is duplicated and the processing speed is slow.

【0010】本発明の目的は、このような欠点を除き、
処理時間の重複を除き、処理速度を改善したリロケータ
ルブル・アセンブラ・システムを提供することにある。
The object of the present invention is to eliminate these drawbacks.
An object of the present invention is to provide a relocatable assembler system in which processing speed is improved by eliminating processing time duplication.

【0011】[0011]

【課題を解決するための手段】本発明の構成は、特定の
文法で記述された計算機の原始プログラムを入力してオ
ブジェクト・モジュールを生成するアセンブラと前記複
数のオブジェクト・モジュールを複数読込みそのプログ
ラム間の相互参照関係を解決して最終的に実行可能な機
械語のロード・モジュールを生成するリンカにより構成
されるリロケータルブル・アセンブル・システムにおい
て、前記原始プログラム内で他の機械語の位置情報を参
照する文が現れ、その文が現れる以前に参照された位置
情報の値が確定している場合のみ最終的な機械語を生成
してオブジェクト・モジュールに出力し、その位置情報
の値が確定していない場合不定の部分を後で埋込む余地
を残した未確定機械語とその位置に対する修正情報をオ
ブジェクト・モジュールに出力するアセンブラと、前記
オブジェクト・モジュールを複数入力しプログラム間の
相互参照関係を解決する前に1オブジェクト・モジュー
ル単位にそのオブジェクト・モジュール内の相互参照関
係を解決するリンカとを備えることを特徴とする。
According to the present invention, an assembler that inputs a source program of a computer described in a specific grammar to generate an object module and a plurality of the object modules that are read in between the programs. In a relocatable assemble system configured by a linker that resolves the cross-reference relations of the above to generate a load module of a machine language that can be finally executed, the position information of other machine languages is stored in the source program. The final machine language is generated and output to the object module only when the referenced sentence appears and the value of the position information referenced before the sentence appears is fixed, and the position information value is fixed. If not, the undefined machine language that leaves room to embed the indefinite part and the correction information for the position are stored in the object module. And a linker for resolving the cross-reference relationship in the object module in units of one object module before inputting a plurality of the object modules and resolving the cross-reference relationship between programs. Is characterized by.

【0012】[0012]

【実施例】図1は、本発明の一実施例のリロケータブル
・アセンブル・システムの基本形の流れ図である。図に
おいて、本実施例は、アセンブラ本体110の構造がパ
ス1処理111のみで実現されており、またリンカ本体
160に1オブジェクト内の相互参照の解決処理180
が加えられている点が大きな相違点である。以下に動作
の詳細を記す。
1 is a flow chart of the basic form of a relocatable assemble system according to an embodiment of the present invention. In the figure, in the present embodiment, the structure of the assembler body 110 is realized only by the path 1 processing 111, and the linker body 160 resolves a cross reference in one object 180.
Is the major difference. The details of the operation will be described below.

【0013】本実施例では、アセンブラ本体110のパ
ス1処理111で原始プログラム100を読込みなが
ら、従来の技術のパス1処理121と同様に現れたシン
ボルとその実際の位置との対応表を作成しながら同時に
従来の技術のパス2処理122と同様に機械語本体13
0を出力する。
In this embodiment, while reading the source program 100 in the pass 1 processing 111 of the assembler body 110, a correspondence table of the symbols that have appeared and their actual positions is created in the same manner as in the pass 1 processing 121 of the prior art. However, at the same time, the machine language main body 13
Outputs 0.

【0014】この場合従来の技術との相違点は、その原
始プログラム内に存在するシンボルがあっても、もし参
照する文が定義する文よりファイル上ではやく出現する
場合には、別の原始プログラムで定義されるシンボルと
同様に未確定の機械語として処理される点が違うことで
ある。その結果、出力されるオブジェクトの内容は、従
来の技術で出力されるオブジェクトと形式上は同様だ
が、機械語本体130は未確定の部分が多く、修正情報
140も多量になり、シンボル・テーブル150もその
1原始プログラム内で定義されて別の原始プログラム内
で参照されないシンボルも余分に出力されたものとな
る。
In this case, the difference from the conventional technique is that even if there is a symbol existing in the source program, if it appears earlier in the file than the statement defined by the referenced statement, another source program is used. The difference is that it is processed as an undetermined machine language like the symbol defined in. As a result, the content of the output object is similar in form to the object output by the conventional technique, but the machine language main body 130 has many undetermined parts, the correction information 140 is large, and the symbol table 150 is large. Also, the symbols defined in the one source program and not referred to in another source program are additionally output.

【0015】一方、リンカ本体160は、上記のオブジ
ェクトを複数入力し機械語を結合してロード・モジュー
ルを出力するが、その処理の流れは、以下のような方法
で実現する。
On the other hand, the linker main body 160 inputs a plurality of the above objects, combines the machine language and outputs the load module, and the processing flow is realized by the following method.

【0016】まず、最初のオブジェクトを読込むが、そ
の処理は一般的なオブジェクトの読込みと機能的には同
様なため、1オブジェクトの読込み処理170で実現す
る。次に、そのオブジェクト内の相互参照の解決処理1
80で最初のオブジェクト内の相互参照関係を解決を修
正情報140とシンボル・テーブル150によって行
う。最初のオブジェクトの場合は、次の処理であるオブ
ジェクト間の相互参照の解決処理190は、オブジェク
トがまだ1個であるので、実行されずにそのまま次の判
断処理200に移る。以降は、指定されたその他のオブ
ジェクトを逐次読込むために上記の処理をオブジェクト
が、なくなるまで繰り返す。
First, the first object is read. Since the processing is functionally similar to the reading of a general object, it is realized by the reading processing 170 for one object. Next, resolution processing 1 of the cross reference in the object
At 80, the cross-reference relation in the first object is resolved by the modification information 140 and the symbol table 150. In the case of the first object, the next processing, that is, the processing for resolving cross-references 190 between objects is not executed because there is still only one object, and the processing proceeds directly to the next determination processing 200. After that, the above processing is repeated until the designated objects are sequentially read until there are no more objects.

【0017】ここで1オブジェクト内の相互参照の解決
処理180とオブジェクト間の相互参照の解決処理19
0の違いは、検索の範囲の相違のみであり、プログラム
上はほぼ同一のものとなるため設計上の利点が大きい。
次に本発明の各部に付いての機能の詳細についての1実
施例を図面を参照して説明する。
Here, a cross-reference resolution process 180 within one object and a cross-reference resolution process 19 between objects are performed.
The difference of 0 is only the difference of the search range, and since they are almost the same in terms of program, there is a great design advantage.
Next, one embodiment of the details of the function of each part of the present invention will be described with reference to the drawings.

【0018】図2は、本実施例のアセンブラ本体110
内のパス1処理111の一例を示す流れ図である。ま
た、次の表1は図2の動作を説明するために用意した原
始プログラムの中身の1例である。
FIG. 2 shows the assembler body 110 of this embodiment.
6 is a flowchart showing an example of the path 1 processing 111 in FIG. Table 1 below is an example of the contents of the source program prepared to explain the operation of FIG.

【0019】[0019]

【表1】 [Table 1]

【0020】この表において、1行目の文11は、この
位置に「L1」というシンボルを定義していることを示
している。この文には、機械語を生成する文が記述され
ていないため、この「L1」というシンボルは自動的に
2行目の内容を指すことになる。2行目の文12は、こ
こから1行目で定義されたシンボル「L1」へ制御を移
す命令を記述した文である。3行目の文13は、次の4
行目で定義されたシンボル「L2」へ制御を移す命令を
記述した文である。4行目の文14は、1行目の文と同
様に「L2」というシンボルを定義している。5行目の
文15は、別のファイルで定義されていると予測される
シンボル「L3」に制御を移す命令を記述した文であ
り、6行目の文16は、別のファイルからこの位置へ制
御を移すことをゆるすシンボル「L4」を定義してい
る。
In the table, sentence 11 on the first line indicates that the symbol "L1" is defined at this position. Since a sentence for generating a machine language is not described in this sentence, the symbol "L1" automatically indicates the contents of the second line. The statement 12 on the second line is a statement in which an instruction to transfer control from here to the symbol “L1” defined on the first line is described. Sentence 13 on the third line is
This is a statement in which an instruction for transferring control to the symbol “L2” defined in the line is described. The sentence 14 in the fourth line defines the symbol "L2" as in the sentence in the first line. The statement 15 on the 5th line is a statement that describes an instruction to transfer control to the symbol "L3" that is predicted to be defined in another file, and the statement 16 on the 6th line is this position from another file. The symbol "L4" that allows the transfer of control to is defined.

【0021】次に、本実施例の図2において、表1の原
始プログラムを入力した場合で説明する。パス1処理
は、まずプログラムの1行読み込み処理300で1行目
の文11を読込む。次の処理であるファイルの最後かの
判断処理310はパス1処理が完了したときにプログラ
ムを終了させるための処理である。次に命令の解析処理
320によりこの分はシンボルの定義のみであると判断
される。その結果次の判断処理330でシンボル登録処
理331が実行され「L1」というシンボルとその位置
情報が登録される。
Next, the case where the source program of Table 1 is input in FIG. 2 of the present embodiment will be described. In the pass 1 processing, first, the sentence 11 in the first line is read in the one-line reading process 300 of the program. The next process, which is a process 310 for determining whether the file is the last, is a process for ending the program when the pass 1 process is completed. Next, the instruction analysis processing 320 determines that this is only the definition of symbols. As a result, the symbol registration process 331 is executed in the next determination process 330, and the symbol "L1" and its position information are registered.

【0022】次に、シンボル参照あり?の判断処理34
0でシンボル参照なしと判断されそのまま機械語生成処
理350に制御を移す。この機械語生成処理350で
は、この文に機械語生成記述がないため何も行わず、再
度プログラムの1行読込み処理300に移る。
Next, is there a symbol reference? Judgment process 34
When it is 0, it is determined that there is no symbol reference, and control is directly transferred to the machine language generation processing 350. In this machine language generation processing 350, since there is no machine language generation description in this sentence, nothing is done, and the process moves to the one-line reading processing 300 of the program again.

【0023】次に2行目の文12が読込まれる。この文
はシンボル「L1」の場所に制御を移す機械語を生成さ
せる「JUMP」という文である。この文が、命令の解
析処理320で解析されシンボル定義がないため処理3
30は行われず、シンボル定義あり?の判断処理340
で参照ありと判断され次のそのシンボルは登録済み?の
判断処理341で既に「L1」というシンボルが登録さ
れているので、シンボル→数値化処理342でシンボル
が示す位置を具体的数値に変換する。その後機械語生成
処理350で「JUMP」という機械語とその飛び先で
ある「L1」の実際の値が組み合わされ機械語本体13
0を出力する。
Next, the sentence 12 on the second line is read. This sentence is a sentence "JUMP" for generating a machine language that transfers control to the place of the symbol "L1". This statement is analyzed in the instruction analysis processing 320 and there is no symbol definition, so processing 3
30 is not done, symbol definition? Determination process 340
Is it judged that there is a reference in and the next symbol is already registered? Since the symbol “L1” has already been registered in the determination processing 341, the position indicated by the symbol is converted into a specific numerical value in the symbol → numerical processing 342. After that, in the machine language generation processing 350, the machine language "JUMP" and the actual value of the jump destination "L1" are combined and machine language body 13
Outputs 0.

【0024】3行目の文13では「L2」というまだ未
登録のシンボルへ制御を移す機械語を生成させる「JU
MP」という文である。この文は判断処理341でシン
ボルが未登録となるまでは2行めの文12と同様な処理
が行われる。そのあと未登録のため修正情報作成処理3
43が実行され、3行目の機械語の位置が未確定という
情報と、その位置は「L2」というシンボルを参照して
いるという修正情報が作成される。
In the sentence 13 on the third line, "JU" for generating a machine language for transferring control to a symbol "L2" which has not been registered yet.
The sentence is "MP". This sentence is processed in the same way as the sentence 12 in the second line until the symbol is unregistered in the determination process 341. After that, since it is not registered, the correction information creation process 3
43 is executed, and the information that the position of the machine language on the third line is undetermined and the correction information that the position refers to the symbol “L2” are created.

【0025】次の機械語生成処理350では「JUM
P」という機械語を飛び先が未確定のまま機械語本体1
30として出力する。
In the next machine language generation processing 350, "JUM
The machine language "P" is the machine language itself 1
Output as 30.

【0026】4行目の文14では、1行目の文11と同
じ処理が行われ、シンボル「L2」が登録される。5行
目の文15は、他の原始プログラムで定義されていると
予想されるシンボル「L3」へ制御を移す機械語を生成
させる「JUMP」という文である。この文の処理は3
行目の文13と全く同様の処理が行われ、「L3」とい
う未登録のシンボルに対する修正情報と未確定の機械語
本体130が出力される。6行目の文16は1行目の文
11に対する処理と同じ処理がなされ「L4」というシ
ンボルが登録される。
In the sentence 14 in the fourth line, the same processing as that in the sentence 11 in the first line is performed, and the symbol "L2" is registered. The statement 15 on the fifth line is a statement "JUMP" that causes a machine language to transfer control to the symbol "L3" which is expected to be defined in another source program. The processing of this sentence is 3
The same processing as that of the sentence 13 on the line is performed, and the correction information for the unregistered symbol "L3" and the undetermined machine language body 130 are output. The sentence 16 in the sixth line is subjected to the same processing as the sentence 11 in the first line, and the symbol “L4” is registered.

【0027】前述のパス1処理111処理の後、アセン
ブラ本体110により最終的に完成された内部的修正情
報とシンボル修正情報140とシンボル・テーブル15
0をファイルとして外部に出力してアセンブラの処理は
完了する。
After the above-mentioned pass 1 processing 111 processing, the internal correction information and the symbol correction information 140 and the symbol table 15 finally completed by the assembler body 110.
The 0 is output as a file to the outside, and the assembler process is completed.

【0028】次の表2(a),(b)は前述の処理で作
成された修正情報140およびシンボル・テーブル15
0を表形式で示した具体例である。
The following Tables 2 (a) and 2 (b) show the modification information 140 and the symbol table 15 created by the above-mentioned processing.
It is a specific example showing 0 in a table format.

【0029】[0029]

【表2】 [Table 2]

【0030】表2(a)において、位置情報は修正すべ
き機械語の具体的位置の数値の欄、シンボルは上記修正
すべき部分をどのシンボルを使って修正するのかを示す
シンボルそのものの欄である。この場合、修正形式はシ
ンボルの具体的値をどのように加工して機械語そのもの
に修正を加えるかの情報を予め決めたコードであり、一
般のアセンブラの場合その文法によって必要になる情報
である。ただし、本実施例においては、関係しないので
これ以上の説明は行わない。
In Table 2 (a), the position information is a column of numerical values of specific positions of the machine language to be corrected, and the symbol is a column of the symbol itself indicating which symbol is used to correct the above-mentioned portion to be corrected. is there. In this case, the modification format is a code that predetermines information about how to modify the concrete value of the symbol to modify the machine language itself, and in the case of a general assembler, it is the information required by its grammar. . However, in the present embodiment, since it is not related, further description will not be given.

【0031】次に表2(a)の第1行21は表1の原始
プログラムの例の3行目の処理によって作成された修正
形式の1組であり、第2行22は5行目の処理によって
作成された修正形式の1組を示している。
Next, the first line 21 of Table 2 (a) is a set of modified formats created by the processing of the third line of the example of the source program of Table 1, and the second line 22 is the fifth line. 4 shows a set of modified formats created by the process.

【0032】次に、表2(a)においては、シンボルは
登録された具体的シンボルのを格納する欄、シンボル値
はそのシンボルが示している実際の値が格納されている
欄212を示している。次に表2(a)の第1行31は
表1の原始プログラムの例の1行目の処理によって登録
されたシンボル「L1」とその位置情報を対応させた行
であり、第2行32は原始プログラムの例の4行目の処
理で、3行目は原始プログラムの例の6行目の処理で登
録されたシンボルとその位置情報の対応させた行であ
る。
Next, in Table 2 (a), the symbol indicates the column for storing the registered concrete symbol, and the symbol value indicates the column 212 for storing the actual value indicated by the symbol. There is. Next, the first line 31 of Table 2 (a) is a line in which the position information is associated with the symbol "L1" registered by the processing of the first line of the example of the source program of Table 1, and the second line 32 Is a process of the fourth line of the example of the source program, and the third line is a line in which the symbol registered in the process of the sixth line of the example of the source program and its position information are associated with each other.

【0033】図3は本発明の第2の実施例のリンカの流
れ図である。ここでも表2(a),(b)は表1の原始
プログラムにから生成された修正情報140およびシン
ボル・デーブル150の一例とする。
FIG. 3 is a flow chart of the linker of the second embodiment of the present invention. Again, Tables 2 (a) and (b) are examples of the modification information 140 and the symbol table 150 generated from the source program of Table 1.

【0034】表2(a)のシンボル名、位置情報は、1
組の修正情報の構成であり、シンボル名は実際の参照し
ているシンボル名自身を格納し、位置情報はそのシンボ
ル名を参照している機械語の位置を格納している。表2
(a)の行番21〜23は、それぞれ表1の2行目、3
行目、5行目(12,13,15)のシンボルを参照し
ている機械語命令によって生成されたシンボルの修正情
報である。ここでは説明を簡単にするための全ての命令
は、同一の長さでかつその長さを1とした場合で説明し
ている。行番21ではシンボル名「L1」を参照してそ
の位置は最初の機械語であるのでその位置は0、行番2
2ではシンボル名「L2」を参照してその位置は1、行
番23ではシンボル名「L3」を参照してその位置は2
となっている。
The symbol name and position information in Table 2 (a) are 1
This is a structure of a set of correction information, where the symbol name stores the actual referenced symbol name itself, and the position information stores the position of the machine language that refers to the symbol name. Table 2
Row numbers 21 to 23 in (a) are the second row and the third row in Table 1, respectively.
It is the modification information of the symbol generated by the machine language instruction that refers to the symbol on the line 5 (12, 13, 15). Here, for simplification of explanation, all the instructions have the same length and the length is set to 1. In line number 21, the symbol name "L1" is referenced, and the position is the first machine language, so the position is 0, line number 2
2, the position is 1 by referring to the symbol name “L2”, and the line number 23 is 2 by referring to the symbol name “L3”.
Has become.

【0035】表2(b)のシンボル・テーブルは、シン
ボル1組に対して参照されたシンボル名およびそのシン
ボルの値で構成されており、行番31〜33は、それぞ
れ表1のシンボルを定義している1行目、4行目、6行
目の文によって生成されたシンボルの対応表である。行
番31ではシンボル名「L1」を定義しておりその位置
は03行番32ではシンボル名「L2」を定義しており
その位置は2、行番33ではシンボル名「L4」を定義
しておりその位置は3になっている。
The symbol table in Table 2 (b) is composed of the symbol name referred to for one set of symbols and the value of the symbol, and the line numbers 31 to 33 define the symbols in Table 1, respectively. 5 is a correspondence table of symbols generated by the statements on the 1st, 4th, and 6th lines. The line number 31 defines the symbol name “L1” and its position is 03, the line number 32 defines the symbol name “L2”, and its position is 2, and the line number 33 defines the symbol name “L4”. The position of the cage is 3.

【0036】次に、図3について表2の例を参考に動作
を説明する。最初の処理である機械語位置及びシンボル
・テーブルの初期化処理400によってシンボル・テー
ブルを空にすると同時に今から読込むオブジェクトの位
置を0に初期設定する。次に、図1の1オブジェクトの
読込み処理170として、処理401〜404が行われ
る。最初に1機械語本体の読み込み処理401で読込む
べき機械語の位置以降に機械語が読み込まれる。次に機
械語位置の加算処理402で次に読込まれる機械語の読
み込み位置を計算するために、そのとき読込まれた機械
語本体の大きさを機械語位置に加える。
Next, the operation will be described with reference to the example of Table 2 with reference to FIG. The machine language position and symbol table initialization processing 400, which is the first processing, empties the symbol table and simultaneously initializes the position of the object to be read to 0. Next, as the reading processing 170 for one object in FIG. 1, processings 401 to 404 are performed. First, the machine language is read after the position of the machine language to be read in the reading process 401 of one machine language body. Next, in order to calculate the read position of the machine language to be read next in the machine word position addition processing 402, the size of the machine language body read at that time is added to the machine word position.

【0037】次に、1シンボル・テーブルの追加読込み
処理403によって、そのオブジェクトのシンボル・テ
ーブルを既に読込まれたシンボルに追加するように登録
する。このシンボル・テーブルは表2(b)に示す形式
のものである。この時点でシンボル・テーブルのシンボ
ルの値には現在の機械語位置の値が加算されながら登録
される。次に1修正情報機械語の読込み処理404によ
って、表2(a)に示すような機械語の修正情報が読込
まれる。ここでも同様に位置情報の部分は、現在に機械
語位置の値が加算されて登録される。
Next, the symbol table of the object is registered to be added to the already read symbol by the additional reading processing 403 of the one symbol table. This symbol table has the format shown in Table 2 (b). At this point, the value of the current machine language position is added to the value of the symbol in the symbol table and registered. Next, by the correction information 1 machine language read processing 404, the machine language correction information as shown in Table 2 (a) is read. In this case as well, the value of the machine language position is added to the position information portion and registered.

【0038】その後、図1の1オブジェクト内の相互参
照の解決処理180として処理405〜407が実行さ
れる。まず修正情報を全て処理するための確認の修正情
報は処理完了か?の処理405により完了確認がされ、
読込まれた修正情報の処理が終了するまで内部の処理を
繰り返させる。次にその修正情報のシンボルはシンボル
・テーブルに有り?の処理406で修正する値を得る。
得られた値によりシンボルの値による機械語の修正処理
407によって機械語が完成される。
After that, the processes 405 to 407 are executed as the process 180 for resolving cross-references within one object in FIG. First, is the confirmation correction information for processing all the correction information completed? Completion is confirmed by the process 405 of
The internal processing is repeated until the processing of the read correction information is completed. Next, is the symbol of the correction information in the symbol table? The value to be corrected is obtained in the processing 406 of.
The machine language is completed by the processing 407 of modifying the machine language by the value of the symbol with the obtained value.

【0039】表2(a)の場合、シンボル名「L1」と
「L2」はシンボル・テーブルにその時点で登録されて
いるので、「L1」は0、「L2」は2という位置が得
られる。そのため処理407によって位置0の機械語の
シンボルによって決まる部分は0という値に変更され、
同様に位置1の機械語の部分は2という値に変更され
る。修正情報の処理が全て完了すると表2の例の場合、
シンボル名「L3」というシンボル名がまだ未定義のま
ま残ることになる。
In the case of Table 2 (a), since the symbol names "L1" and "L2" are registered in the symbol table at that time, the position "L1" is 0 and the position "L2" is 2. . Therefore, the portion determined by the machine language symbol at position 0 is changed to a value of 0 by processing 407,
Similarly, the machine language portion at position 1 is changed to a value of 2. In case of the example in Table 2 when all the processing of the correction information is completed,
The symbol name “L3” remains undefined.

【0040】その後オブジェクト間の相互参照の解決処
理190として処理408〜410までが実行される。
以前にシンボル・テーブルになかった修正情報は有り?
の処理408は、その時点で読込まれたオブジェクトで
はなく、その1つ前までに読み込まれたオブジェクトに
対しての判断処理である。そのため最初のオブジェクト
の読込み時点では修正情報はなかったと判断され処理1
70に戻る。次に別のオブジェクトが読み込まれる。そ
してそのオブジェクトの処理が処理180まで完了する
と再び処理190に処理が移る。
After that, processes 408 to 410 are executed as a process 190 of resolving cross-references between objects.
Is there any correction information that was not in the symbol table before?
Process 408 is a determination process for an object read immediately before that, not an object read at that time. Therefore, it is determined that there is no correction information at the time of reading the first object, and processing 1
Return to 70. Then another object is loaded. When the processing of the object is completed up to the processing 180, the processing moves to the processing 190 again.

【0041】もし、そのとき読み込まれたオブジェクト
の中に「L3」というシンボルが定義されていると、そ
の修正情報のシンボルはシンボル・テーブルにあるか?
の処理409によりシンボル名「L3」が発見され処理
407と同様な処理シンボルの値による機械語の修正処
理410により位置2の機械語の部分が「L3」として
登録されている値により変更される。このようにして全
ての指定されたオブジェクトの読込みが完了するまで、
上記の処理が繰返されることにより全てのシンボルの相
互参照が完了する。
If the symbol "L3" is defined in the object read at that time, is the symbol of the correction information in the symbol table?
The symbol name "L3" is found by the process 409 of step 409, and the machine language part at the position 2 is changed by the value registered as "L3" by the process 410 of modifying the machine language by the value of the process symbol similar to the process 407. . In this way, until reading of all specified objects is completed,
By repeating the above process, cross reference of all symbols is completed.

【0042】[0042]

【発明の効果】以上説明したように本発明によれば、従
来のリロケータブル・アセンブル・システムのアセンブ
ラ部分の処理がほぼ半減し、リンカの処理は従来のリン
カの処理と同様な処理が追加されるだけであるので、プ
ログラムの容量の増加はほとんどなく、処理時間は従来
の機械語文法の解析にかかる時間に比べはるかに少ない
値ですむ効果が期待できる。
As described above, according to the present invention, the processing of the assembler portion of the conventional relocatable assemble system is almost halved, and the processing of the linker is similar to the processing of the conventional linker. Therefore, there is almost no increase in the capacity of the program, and the processing time can be expected to be much less than the time required for parsing the conventional machine grammar.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明のリロケータブル・アセンブラ・システ
ムの一実施例の流れ図。
FIG. 1 is a flow chart of an embodiment of a relocatable assembler system of the present invention.

【図2】図1のシステムのアセンブラのパス1処理の一
例の流れ図。
2 is a flow chart of an example of pass 1 processing of the assembler of the system of FIG.

【図3】図1のシステムのリンカの一例の流れ図。3 is a flow chart of an example of a linker for the system of FIG.

【図4】従来のリロケータブル・アセンブル・システム
の一例の流れ図。
FIG. 4 is a flowchart of an example of a conventional relocatable assemble system.

【符号の説明】[Explanation of symbols]

100 原始プログラム 110 アセンブラ本体 111 パス1処理 121,122 従来のパス1,2処理 130,131 機械語本体 140,141 修正情報 150,151 シンボル・テーブル 160 リンカ本体 170 1オブジェクトの読込み処理 171 従来の最初のオブジェクトの読込み処理 172 従来の次のオブジェクトの読込み処理 180 1オブジェクト内の相互参照解決 190,191 オブジェクト間の相互参照解決処理 200 残りのオブジェクトの有無の評価 210 ロード・モジュール 300 プログラムの1行読込み処理 310 プログラムの最後判定処理 320 プログラム1行の解析処理 330 シンボル定義の有無の判断処理 331 シンボルの登録処理 340 シンボルの参照の有無の判断処理 341 シンボルの既に登録されている判断処理 342 シンボルの数値化処理 343 修正情報の作成処理 350 機械語生成処理 400 シンボル・テーブルの初期処理 401 1組のオブジェクトの機械語本体部分を読込
む処理 402 機械語本体の大きさの加算処理 403 1組のオブジェクトのシンボル・テーブル部
分を読込む処理 404 1組のオブジェクトの修正情報の部分を読込
む処理 405 1組のオブジェクト内での修正情報の処理完
了の確認処理 406,409 修正情報のシンボルのシンボル・テ
ーブルへの登録判断処理 407,410 シンボル・テーブル内の値による完
全な機械語への修正処理 408 シンボル・テーブルに未登録のシンボルの有
無の確認処理 11 シンボル「L1」の定義を指定する文 12 シンボル「L1」へ制御を移す計算機用機械語
の生成を指定する文 13 シンボル「L2」へ制御を移す計算機用機械語
の生成を指定する文 14 シンボル「L2」の定義を指定する文 15 シンボル「L3」へ制御を移す計算機用機械語
の生成を指定する文 16 シンボル「L4」の定義を指定する文 21〜23 シンボル「L1」,「L2」および「L
3」を参照していることにより生成された修正情報 31〜33 シンボル「L1」,「L2」および「L
3」の定義情報
100 Source program 110 Assembler body 111 Path 1 processing 121,122 Conventional path 1, 2 processing 130,131 Machine language body 140,141 Modification information 150,151 Symbol table 160 Linker body 170 1 Object reading processing 171 Conventional first Object read processing of 172 Conventional read processing of the next object 180 1 Cross-reference resolution within an object 190, 191 Cross-reference resolution processing between objects 200 Evaluating the existence of remaining objects 210 Load module 300 Reading one line of a program Processing 310 Program end determination processing 320 Program one line analysis processing 330 Symbol definition presence / absence determination processing 331 Symbol registration processing 340 Symbol reference presence / absence determination processing 341 Symbol Already registered judgment process 342 Symbol digitization process 343 Correction information creation process 350 Machine language generation process 400 Symbol table initialization process 401 Process of reading the machine language main part of a set of objects 402 Machine language Addition of main body size 403 Processing to read symbol table part of one set of objects 404 Processing to read correction information part of one set of objects 405 Confirm completion of processing of modification information in one set of objects Processing 406,409 Processing for determining whether or not correction information symbols are registered in the symbol table 407,410 Correction processing for a complete machine language based on the values in the symbol table 408 Processing for checking whether there are unregistered symbols in the symbol table Statement that specifies the definition of symbol "L1" 12 Control to symbol "L1" The statement that specifies the generation of the machine language for the computer that transfers the statement 13 The statement that specifies the generation of the machine language for the computer that transfers the control 14 The statement that specifies the definition of the symbol “L2” 15 Statement for specifying generation of machine language for computer to be transferred 16 Statement for specifying definition of symbol "L4" 21 to 23 Symbols "L1", "L2" and "L"
Modification information 31 to 33 generated by referring to "3" Symbols "L1", "L2" and "L"
3 ”definition information

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 特定の文法で記述された計算機の原始プ
ログラムを入力して機械語情報(以下オブジェクト・モ
ジュールという)を生成するプログラム(以下アセンブ
ラという)と前記オブジェクト・モジュールを複数読込
みそのプログラム間の相互参照関係を解決して最終的に
実行可能な機械語(以下ロード・モジュールという)を
生成するプログラム(以下リンカという)により構成さ
れるリロケータブル・アセンブル・システムにおいて、
前記原始プログラム内で他の機械語の位置情報を参照す
る文が現れ、参照された位置情報の値が既に確定してい
るとき、最終的な機械語を生成してオブジェクト・モジ
ュールに出力し、前記位置情報の値が確定していないと
き、不定の部分を後で埋込む余地を残した機械語(以下
未確定機械語という)とその位置が未確定であることを
示す情報及びその修正形式情報(以下修正情報という)
をオブジェクト・モジュールに出力する手段を持つアセ
ンブラと、前記オブジェクト・モジュールを複数入力し
プログラム間の相互参照関係を解決する前に1オブジェ
クト・モジュール単位にそのオブジェクト・モジュール
内の相互参照関係を解決するリンカとを備えることを特
徴とするリロケータブル・アセンブル・システム。
1. A program (hereinafter, referred to as an assembler) for generating a machine language information (hereinafter, referred to as an object module) by inputting a source program of a computer described in a specific grammar, and a plurality of the object modules are read, and the program is stored between the programs. In a relocatable assemble system composed of a program (hereinafter referred to as a linker) that resolves the cross-reference relation of and finally generates an executable machine language (hereinafter referred to as a load module),
When a statement referring to position information of another machine language appears in the source program and the value of the referenced position information is already fixed, a final machine language is generated and output to the object module, When the value of the position information is not fixed, a machine language that leaves room for embedding an indefinite part (hereinafter referred to as undetermined machine language), information indicating that the position is undetermined, and a modification form thereof Information (hereinafter referred to as correction information)
And an assembler having means for outputting the object module, and resolving the cross-reference relationship within the object module in units of one object module before resolving the cross-reference relationship between the programs by inputting a plurality of the object modules. A relocatable assemble system comprising a linker.
JP20988292A 1992-08-06 1992-08-06 Relocatable assembling system Pending JPH0659903A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP20988292A JPH0659903A (en) 1992-08-06 1992-08-06 Relocatable assembling system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP20988292A JPH0659903A (en) 1992-08-06 1992-08-06 Relocatable assembling system

Publications (1)

Publication Number Publication Date
JPH0659903A true JPH0659903A (en) 1994-03-04

Family

ID=16580214

Family Applications (1)

Application Number Title Priority Date Filing Date
JP20988292A Pending JPH0659903A (en) 1992-08-06 1992-08-06 Relocatable assembling system

Country Status (1)

Country Link
JP (1) JPH0659903A (en)

Similar Documents

Publication Publication Date Title
US5371747A (en) Debugger program which includes correlation of computer program source code with optimized object code
JP3599775B2 (en) Finite state coding system for hyphenation rules
JPH0630066B2 (en) Table type language translation method
US6968544B1 (en) Method for transformation of interface definitions and intermediate format tables thereof
JPH0659903A (en) Relocatable assembling system
JPH04286029A (en) Source program converter
JPS62205431A (en) Branching instruction processing system
JPS6022373B2 (en) Program conversion mechanism for programmable control equipment
JPH0667871A (en) Automatic program updating system
JPH0695890A (en) Name replacement system in compiler
JP2003076547A (en) System and method for automatically generating control software
JPH06236283A (en) Language processing system
JPH03100730A (en) Method for emergency correction data generation processing with high grade language
JPH05150960A (en) Precompiler
JPH03156641A (en) Compiling process system
CN113609821A (en) Regular expression conversion method, device, equipment and storage medium
JPS6326730A (en) Program correction system
JPH02253443A (en) Program generating method
JPH0390931A (en) Generation of rom transformation program
JPH0371231A (en) Source list forming system
JPH02244332A (en) Assembler object editing output system
JPH03186933A (en) Symbol processing system for language processing system
JPH0371229A (en) Program controller
Sighireanu The specification of the Dc2Sdx translator
JPH03235128A (en) In-line development processing method for taking over working directory

Legal Events

Date Code Title Description
A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 19990928