JP2006048431A - Dynamic link library processor - Google Patents

Dynamic link library processor Download PDF

Info

Publication number
JP2006048431A
JP2006048431A JP2004229555A JP2004229555A JP2006048431A JP 2006048431 A JP2006048431 A JP 2006048431A JP 2004229555 A JP2004229555 A JP 2004229555A JP 2004229555 A JP2004229555 A JP 2004229555A JP 2006048431 A JP2006048431 A JP 2006048431A
Authority
JP
Japan
Prior art keywords
dynamic link
virtual address
link library
program
library
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
JP2004229555A
Other languages
Japanese (ja)
Inventor
Kenji Ejima
賢司 江島
Kazutomi Kato
一臣 加藤
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial 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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2004229555A priority Critical patent/JP2006048431A/en
Publication of JP2006048431A publication Critical patent/JP2006048431A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a dynamic link library processor capable of increasing the efficiency of execution. <P>SOLUTION: A virtual address layout plan indicating positions on a virtual address where respective dynamic link libraries are positioned is created, and the dynamic link libraries are relocated in accordance with the virtual address layout plan. When the dynamic link libraries are loaded, the dynamic link libraries are loaded to the positions indicated on the virtual address layout plan. This enables the use of position dependent codes with high efficiency of execution to be used as the codes of the dynamic link libraries and enables dynamic codes to be shared among a plurality of processes. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、実行可能プログラム及び動的リンクライブラリのリンクおよびロードを行う動的リンクライブラリ処理装置に関するものである。   The present invention relates to a dynamic link library processing apparatus that links and loads an executable program and a dynamic link library.

コンピュータシステムにおいて、複数のプログラムで共通する処理は多くある。複数のプログラムで共通する処理をプログラムごとに開発する事は重複であり、非効率的である。そこで、複数のプログラムで共通する処理は、ライブラリとしてまとめられて開発される。   There are many processes common to a plurality of programs in a computer system. Developing processes common to multiple programs for each program is redundant and inefficient. Therefore, processes common to a plurality of programs are developed together as a library.

ライブラリが一度開発され、このライブラリを使用する複数のプログラムの本体部分が開発されるという形で開発が進められ、共通の処理が重複開発される事がなくなる。   Development is progressed in such a way that a library is developed once, and main parts of a plurality of programs using the library are developed, and common processing is not duplicated.

一般に、ライブラリはプログラムの本体部分から切り離されて、カプセル化されて構築される。プログラムの本体部分と、ライブラリがそれぞれ別々に構築され、最後にこれらをリンクして、実行可能プログラムが生成される。   Generally, a library is constructed by being encapsulated separately from the main part of the program. The main part of the program and the library are constructed separately, and finally, these are linked to generate an executable program.

リンクとは、プログラム内のある部分と別の部分を連結する処理である。リンク処理はリンカによって行なわれる。リンク処理では、例えば関数呼び出しなどで、呼び出し元と呼び出し先を連結するといった処理が行なわれる。   Linking is a process of connecting one part and another part in a program. Link processing is performed by the linker. In the link process, for example, a function call is performed to connect the caller and the callee.

例えば、プログラムの本体部分から、ライブラリ内にある関数を呼び出すときを考える。一般に、関数呼び出しでは、呼び出し元から呼び出し先にジャンプする機械語命令が使用される。したがって、呼び出し先の関数が書かれているアドレスを呼び出し元のコードに書き込む事になる。リンカは、まずライブラリ内にある関数(呼び出し先)のアドレスを取得する。次に、このアドレスをプログラム本体部分(呼び出し元)に書き込む。これにより、呼び出し元と呼び出し先が適切にリンクされ、プログラムの本体部分からライブラリ内にある関数が呼び出せるようになる。また、このように、アドレスを解決して、コードなどを書き換える作業をリロケート(再配置)と言う。   For example, consider a case where a function in a library is called from the main part of a program. In general, in a function call, a machine language instruction for jumping from a caller to a callee is used. Therefore, the address where the callee function is written is written in the caller code. The linker first obtains the address of a function (call destination) in the library. Next, this address is written in the program body (caller). As a result, the caller and the callee are appropriately linked, and the function in the library can be called from the main part of the program. In addition, the work of resolving the address and rewriting the code or the like in this way is called relocation (relocation).

ライブラリをリンクする方法は、大きく分けて2つある。ひとつは静的リンク方式であり、もうひとつは動的リンク方式である。   There are two main methods for linking libraries. One is a static link method and the other is a dynamic link method.

静的リンク方式は、実行可能プログラムを構築するときに、ライブラリのコードのコピーを作って、プログラムの本体部分にリンクする方式である。ライブラリの開発自体が重複するわけではないが、構築されたライブラリのコードは複数のプログラムにコピーされる事になる。静的リンク方式では、実行可能プログラムを構築するときにプログラム本体部分とライブラリがリンクされるため、実行可能プログラムは単体で実行できるものである。   The static link method is a method of making a copy of a library code and linking it to the main part of the program when an executable program is constructed. The library development itself does not overlap, but the code of the constructed library is copied to multiple programs. In the static linking method, the executable program can be executed alone because the program body and the library are linked when the executable program is constructed.

静的リンク方式では、複数のプログラムに同じライブラリのコードがコピーされるため、コンピュータシステム内にひとつのコードのコピーがたくさん作られてしまう可能性がある。また、仮想メモリ機構を使用するコンピュータシステムの場合、同じコードがメモリ上に重複して存在してしまう場合が発生してしまう事もある。このため、近年のコンピュータシステムでは下記で説明する動的リンク方式が採用される事が多い。   In the static linking method, the code of the same library is copied to a plurality of programs, so there is a possibility that many copies of one code are made in the computer system. In the case of a computer system that uses a virtual memory mechanism, the same code may be duplicated on the memory. For this reason, in recent computer systems, the dynamic link method described below is often adopted.

動的リンク方式は、実行可能プログラムの本体部分にライブラリのコードを含めず、プログラム実行時にライブラリを読み込んでリンクする方式である。プログラムの本体部分である実行可能プログラムにはライブラリのコードが含まれていないため、プログラムの本体部分は最初、未解決のアドレス参照を含んでいる。したがって、実行可能プログラムは、単体では実行できない場合がある。実行可能プログラムの起動時や、ライブラリ内の情報が必要になったときに、プログラム本体とライブラリがリンクされる。   In the dynamic linking method, the library code is not included in the main part of the executable program, and the library is read and linked when the program is executed. Since the executable program that is the main part of the program contains no library code, the main part of the program initially contains an unresolved address reference. Therefore, an executable program may not be executed alone. When the executable program is started or when information in the library is required, the program body and the library are linked.

業界標準のフォーマットであるELFを用いた動的リンク方式として、GOT(Global Offset Table)等のアプリケーション・バイナリ・インタフェースを用いた方法が、特許文献1で開示されている。GOTは、プログラムの本体部分やライブラリが、異なるライブラリのアドレスを参照するときに使用されるアドレスのテーブルである。   Patent Document 1 discloses a method using an application binary interface such as GOT (Global Offset Table) as a dynamic link method using ELF which is an industry standard format. The GOT is a table of addresses used when the main part of the program and the library refer to addresses of different libraries.

例えば、あるライブラリXと、別のライブラリYを使用するプログラムが実行されるときを考える。このとき、ライブラリYの中に関数fがあり、この関数がライブラリXから使用されるものとする。プログラムが実行されると、このプログラムが使用するライブラリがロードされ、それぞれのライブラリのGOTが初期化される。ライブラリXのGOTには、fのためのエントリが用意されている。この、fのためのエントリには、関数fのアドレスが格納される。すなわち、ライブラリYの中にある関数fのアドレスが、ライブラリXのGOTに格納される事になる。ライブラリXから関数fを呼び出すとき、GOTを調べて関数fのアドレスを取得し、取得したアドレスにジャンプする。   For example, consider a case where a program using a certain library X and another library Y is executed. At this time, there is a function f in the library Y, and this function is used from the library X. When the program is executed, the library used by the program is loaded, and the GOT of each library is initialized. An entry for f is prepared in the GOT of the library X. In the entry for f, the address of the function f is stored. That is, the address of the function f in the library Y is stored in the GOT of the library X. When the function f is called from the library X, the GOT is examined to obtain the address of the function f, and the jump is made to the obtained address.

あるライブラリが、ライブラリ外のアドレスを参照するとき、直接そのアドレスを参照するのではなく、GOTを経由して参照する事になる。ライブラリのコード自体は、ライブラリ外のアドレスがどこにあっても変わらない。したがって、GOTを使用すると、位置独立コードを生成する事ができる。位置独立コードは、プログラムのコードがアドレス空間のどの位置に配置されても良いコード、すなわち位置に依存しないコードである。位置に依存する情報は、GOTにまとめられており、GOTはライブラリのロード時などに初期化される。   When a library refers to an address outside the library, it does not refer to the address directly, but refers to it via GOT. The library code itself does not change wherever the address is outside the library. Therefore, when GOT is used, a position independent code can be generated. The position-independent code is a code in which the code of the program may be arranged at any position in the address space, that is, a position-independent code. The position-dependent information is collected in the GOT, and the GOT is initialized when the library is loaded.

あるライブラリのコードが位置独立のとき、このライブラリはアドレス空間のどの位置に配置されても良い。したがって、このライブラリがロードされるときに、ライブラリのコードが書き換えられる必要がない。   When the code of a library is position-independent, this library may be placed at any position in the address space. Therefore, the library code need not be rewritten when this library is loaded.

ライブラリのコードは書き換えられないため、コードの内容は不変である。このため、仮想メモリ機構を使用するマルチプロセス環境において、複数のプログラムが同じライブラリを使用するとき、このライブラリのコードを共有する事が可能となる。例えば、それぞれが独立した仮想アドレス空間で動作している異なるプログラムが複数あったとする。これらのプログラムが同じライブラリを異なる位置にロードしたとする。ライブラリのコードは位置独立であり、どの位置にロードされていてもコードは不変である。したがって、これらの異なるプログラムは、全く同じコードを参照している事になる。このため、これらのプログラムは、ライブラリのコードを共有する事ができる。   Since the library code cannot be rewritten, the contents of the code are unchanged. Therefore, in a multi-process environment using a virtual memory mechanism, when a plurality of programs use the same library, it is possible to share the code of this library. For example, assume that there are a plurality of different programs each operating in an independent virtual address space. Suppose these programs load the same library at different locations. The library code is position-independent, and the code is unchanged regardless of where it is loaded. Therefore, these different programs refer to the exact same code. Therefore, these programs can share the library code.

ライブラリのコードが共有されると、同じライブラリを複数回ロードする必要がなく、またメモリ上にライブラリのコードが重複して存在する必要がない。このため、メモリの使用効率が良い。
特開平8−179947号公報
If the code of the library is shared, it is not necessary to load the same library more than once, and it is not necessary to duplicate the code of the library in the memory. For this reason, the memory use efficiency is good.
JP-A-8-179947

前記のGOTを用いた方法では、ライブラリのコードを位置独立にする事ができる。その結果、異なる仮想アドレス空間で動作するプログラム間であっても、ライブラリのコードを共有する事ができる。   In the method using GOT, the library code can be position-independent. As a result, the library code can be shared even between programs operating in different virtual address spaces.

しかしながら、GOTを用いた方法では、ライブラリ外のアドレスを参照するときに、直接参照先のアドレスにアクセスするのではなく、GOTを経由した間接参照となってしまうという問題点があった。例えば、関数呼び出しの場合を考える。直接アドレス参照であれば、あらかじめコードに書き込まれている参照先のアドレスに直接ジャンプするだけで関数呼び出しが実現できる。他方、間接アドレス参照の場合、いったんGOTから参照先のアドレスを取得してレジスタに保存し、レジスタが示すアドレスにジャンプする処理が必要になる。間接参照は、直接参照と比較して処理命令数が増加してしまい、実行効率の低下につながってしまうという問題点があった。   However, the method using GOT has a problem in that when referring to an address outside the library, the address of the reference destination is not directly accessed, but indirect reference is made via GOT. For example, consider the case of a function call. In the case of direct address reference, a function call can be realized simply by jumping directly to a reference destination address written in advance in the code. On the other hand, in the case of indirect address reference, it is necessary to obtain a reference destination address from the GOT, store it in a register, and jump to the address indicated by the register. Indirect referencing has the problem that the number of processing instructions increases compared to direct referencing, leading to a decrease in execution efficiency.

本発明は上記問題点を解決するためになされたもので、実行効率を高めることのできる動的リンクライブラリ処理装置を提供することを目的とする。   The present invention has been made to solve the above-described problems, and an object of the present invention is to provide a dynamic link library processing apparatus capable of improving execution efficiency.

本発明では、前記の課題を解決するために、どの動的リンクライブラリを仮想アドレス空間の中のどの位置にロードするのかを示す仮想アドレス配置プランを作り、この仮想アドレス配置プランに基づいて動的リンクライブラリをリロケートし、動的リンクライブラリがロードされる時に仮想アドレス配置プランに示される位置にロードされるようにする。   In the present invention, in order to solve the above-mentioned problem, a virtual address arrangement plan indicating which dynamic link library is loaded at which position in the virtual address space is created, and the dynamic address arrangement plan is dynamically generated based on the virtual address arrangement plan. Relocate the link library so that it is loaded at the location indicated in the virtual address placement plan when the dynamic link library is loaded.

仮想アドレスの配置プランにより、それぞれの動的リンクライブラリが仮想アドレス空間のどの位置に配置されるのかが決まる。それぞれの動的リンクライブラリが配置されるアドレスは重複しないように決められる。   The location of each dynamic link library in the virtual address space is determined by the placement plan of the virtual address. The address where each dynamic link library is arranged is determined so as not to overlap.

さらに、この仮想アドレス配置プランに従って、それぞれの動的リンクライブラリは、プログラム実行前にリロケートされる。例えば、ある動的リンクライブラリXが、別の動的リンクライブラリYの中にある関数fを呼び出すときを考える。動的リンクライブラリYが仮想アドレスのどの位置に配置されるのかが仮想アドレス配置プランにより決まっているため、動的リンクライブラリYの中の関数fが置かれているアドレスも決まっている。動的リンクライブラリXから、関数fを呼び出すコードは、直接関数fのアドレスにジャンプするようにリロケートされる。   Furthermore, according to this virtual address allocation plan, each dynamic link library is relocated before program execution. For example, consider a case where a certain dynamic link library X calls a function f in another dynamic link library Y. Since the position where the dynamic link library Y is arranged in the virtual address is decided by the virtual address arrangement plan, the address where the function f in the dynamic link library Y is arranged is also decided. The code that calls the function f from the dynamic link library X is relocated so as to jump directly to the address of the function f.

ローダによって動的リンクライブラリまたは実行可能プログラムがメモリ上にロードされるときに、ロード対象の動的リンクライブラリまたは実行可能プログラムが異なる仮想アドレス空間上で既にロードされている場合、そのコードは共有され、そうでない場合は、仮想アドレス配置プランで決められた位置に動的リンクライブラリまたは実行可能プログラムが配置される。   When a dynamic link library or executable program is loaded into memory by the loader, if the dynamic link library or executable program to be loaded is already loaded in a different virtual address space, the code is shared. Otherwise, the dynamic link library or executable program is placed at the location determined by the virtual address placement plan.

本発明にかかる動的リンクライブラリ処理装置を用いると、仮想メモリ機構を使用するマルチプロセス環境においてライブラリのコードを複数の仮想アドレス空間で共有する事ができ、かつ、仮想アドレスの位置に依存するコードを用いる事ができる。ライブラリのコードは共有されるため、メモリ使用効率が良い。また、アドレスの位置に依存するコードであるため、アドレス参照で直接参照を使用する事ができ、実行効率が向上する。   When the dynamic link library processing apparatus according to the present invention is used, a library code can be shared by a plurality of virtual address spaces in a multi-process environment using a virtual memory mechanism, and the code depends on the position of the virtual address. Can be used. Since the library code is shared, memory use efficiency is good. In addition, since the code depends on the address position, direct reference can be used for address reference, and execution efficiency is improved.

例えば、ある動的リンクライブラリに、別の動的リンクライブラリのデータを直接アドレス参照するような位置依存コードがあったとしても、それぞれの動的リンクライブラリが配置されるアドレスは仮想アドレス配置プランによって決定されている。このため、参照先のアドレスはプログラム実行前に分かっており、事前にアドレス解決が行われている。それぞれの動的リンクライブラリのコードは既にリロケートされているため、実行時にコードを書き換える必要がない。このため、動的リンクライブラリのコードを異なる仮想アドレス空間で共有する事ができる。   For example, even if there is location-dependent code that directly references the data of another dynamic link library in one dynamic link library, the address where each dynamic link library is allocated depends on the virtual address allocation plan. It has been decided. For this reason, the address of the reference destination is known before executing the program, and address resolution is performed in advance. Since the code of each dynamic link library has already been relocated, there is no need to rewrite the code at runtime. For this reason, the code of the dynamic link library can be shared in different virtual address spaces.

本発明の実施の形態について、図面を参照して説明する。   Embodiments of the present invention will be described with reference to the drawings.

(実施の形態1)
図1は本発明の実施の形態1における動的リンクライブラリ処理装置の構成を示す図である。
(Embodiment 1)
FIG. 1 is a diagram showing a configuration of a dynamic link library processing apparatus according to Embodiment 1 of the present invention.

二次記憶装置101は、プログラムやデータを保存する装置であって、動的リンクライブラリ102、実行可能プログラム103、仮想アドレス配置プラン104を保存している。なお、二次記憶装置はこれら以外にもユーザのデータなど他の情報を保存しておいても良い。   The secondary storage device 101 is a device that stores programs and data, and stores a dynamic link library 102, an executable program 103, and a virtual address arrangement plan 104. The secondary storage device may store other information such as user data in addition to these.

動的リンクライブラリ102は、プログラムが実行するときに使用するコードやデータを含むライブラリであり、ひとつまたは複数存在している。動的リンクライブラリの詳細な説明は図2を用いて後述する。   The dynamic link library 102 is a library that includes code and data used when a program is executed, and one or more dynamic link libraries 102 exist. A detailed description of the dynamic link library will be described later with reference to FIG.

実行可能プログラム103は、それぞれのプログラムのうちのライブラリを除いた本体部分であり、ひとつまたは複数存在している。実行可能プログラムの詳細な説明は図2を用いて後述する。   The executable program 103 is a main body part of each program excluding the library, and there is one or more executable programs 103. A detailed description of the executable program will be described later with reference to FIG.

仮想アドレス配置プラン104は、それぞれの動的リンクライブラリ102や実行可能プログラム103が、プログラム実行時に、仮想アドレス上のどの位置に配置されるのかを示すプランである。仮想アドレス配置プラン104の詳細な説明は図4を用いて後述する。   The virtual address arrangement plan 104 is a plan indicating where each dynamic link library 102 or executable program 103 is arranged on a virtual address when the program is executed. A detailed description of the virtual address arrangement plan 104 will be described later with reference to FIG.

仮想アドレス配置プラン生成部105は、ひとつまたは複数の、実行可能プログラム103と動的リンクライブラリ102を受け取り、仮想アドレス配置プラン104を生成する。仮想アドレス配置プランを生成する処理の詳細な説明は図6を用いて後述する。   The virtual address arrangement plan generation unit 105 receives one or a plurality of executable programs 103 and the dynamic link library 102 and generates a virtual address arrangement plan 104. A detailed description of the process of generating the virtual address arrangement plan will be described later with reference to FIG.

配置プラン対応リロケータ106は、ひとつまたは複数の、実行可能プログラム103と動的リンクライブラリ102を受け取り、それぞれの実行可能プログラムと動的リンクライブラリを、仮想アドレス配置プラン生成部105が生成した、仮想アドレス配置プラン104に基づいてリロケートする。仮想アドレス配置プランを用いたリロケート処理の詳細な説明は図6を用いて後述する。   The arrangement plan corresponding relocator 106 receives one or a plurality of executable programs 103 and dynamic link libraries 102, and each of the executable programs and dynamic link libraries is generated by the virtual address arrangement plan generation unit 105. Relocate based on the placement plan 104. A detailed description of the relocation process using the virtual address arrangement plan will be described later with reference to FIG.

配置プラン対応ローダ107は、配置プラン対応リロケータ106がリロケートした実行可能プログラム103と動的リンクライブラリ102を受け取り、ロード対象の実行可能プログラムまたは動的リンクライブラリと同じ実行可能プログラムまたは動的リンクライブラリが既にロードされている場合はそのコードを共有し、そうでない場合は、仮想アドレス配置プラン104に従った仮想アドレス上での位置にロード対象の実行可能プログラムまたは動的リンクライブラリをロードする。仮想アドレス配置プランに従ったロード処理の詳細な説明は図10を用いて後述する。   The placement plan support loader 107 receives the executable program 103 and the dynamic link library 102 relocated by the placement plan support relocator 106, and the same executable program or dynamic link library as the load target executable program or dynamic link library is received. If it is already loaded, the code is shared. Otherwise, the executable program or the dynamic link library to be loaded is loaded at a position on the virtual address according to the virtual address arrangement plan 104. A detailed description of the load process according to the virtual address arrangement plan will be described later with reference to FIG.

図2は、ひとつの実行可能プログラムまたは動的リンクライブラリに含まれる情報を示す図である。なお、以下では、実行可能プログラムと動的リンクライブラリを総称して、プログラムバイナリと呼ぶ。   FIG. 2 is a diagram showing information included in one executable program or dynamic link library. Hereinafter, the executable program and the dynamic link library are collectively referred to as a program binary.

ヘッダ情報201には、そのプログラムバイナリ全体の情報が含まれている。含まれている情報は、そのプログラムバイナリが実行可能プログラムなのか動的リンクライブラリなのかを示すフラグ、ファイル形式のバージョン情報、使用するエンディアンの情報、対応アーキテクチャ、含まれているセクションとその位置、使用する動的リンクライブラリなどである。   The header information 201 includes information on the entire program binary. The information included includes a flag indicating whether the program binary is an executable program or a dynamic link library, file format version information, endian information to be used, supported architecture, included sections and their locations, Dynamic link library to be used.

テキストセクション202には、そのプログラムバイナリのテキストが含まれている。テキストとは、CPUが実行する機械語命令の列である。CPUは、実行時にメモリ上に配置されたテキストに従って、書かれている命令をひとつずつ読み込み、実行する。本実施の形態では、実行効率の高い位置依存コードのテキストの場合を説明する。なお、テキストは、位置独立コードであっても良い。   Text section 202 contains the text of the program binary. A text is a sequence of machine language instructions executed by the CPU. The CPU reads and executes the written instructions one by one according to the text arranged on the memory at the time of execution. In the present embodiment, a description will be given of a case of position-dependent code text with high execution efficiency. The text may be a position independent code.

データセクション203には、そのプログラムバイナリが使用するデータが含まれている。例えば、そのプログラムバイナリの元となったソースコードに、大域変数があったとする。また、この大域変数には初期値が設定されていたとする。この大域変数の初期値は、データセクションに格納される。プログラムバイナリのロード時に、大域変数の初期値がデータセクションから読み出されて大域変数が初期化される。   The data section 203 includes data used by the program binary. For example, suppose that there is a global variable in the source code that is the source of the program binary. Also assume that an initial value is set for this global variable. The initial value of this global variable is stored in the data section. When the program binary is loaded, the initial value of the global variable is read from the data section and the global variable is initialized.

bssセクション204には、そのプログラムバイナリが使用する初期化不要のデータが含まれている。前記データセクション203では、初期値を必要とする大域変数のためのデータが含まれており、ロード時にデータセクション203からその初期値が読み出されて大域変数が初期化される。しかし、大域変数によっては明示的な初期化を必要としないものもある。初期化を必要としない大域変数はbssセクションに含まれ、例えばゼロ初期化されるなどの処理がローダによって行なわれる。   The bss section 204 includes initialization-free data used by the program binary. The data section 203 includes data for a global variable that requires an initial value. When the data section 203 is loaded, the initial value is read from the data section 203 and the global variable is initialized. However, some global variables do not require explicit initialization. Global variables that do not require initialization are included in the bss section, and processing such as zero initialization is performed by the loader.

リロケート情報205には、そのプログラムバイナリの、テキストセクション202やデータセクション203をリロケートするときに必要な情報である未解決参照情報が含まれている。未解決参照情報は、未解決のままになっているアドレス参照の位置と、参照先のシンボルの情報の組からなる。リロケート情報205には、未解決のままになっているアドレス参照の数だけ、未解決参照情報が存在している。   The relocate information 205 includes unresolved reference information, which is information necessary for relocating the text section 202 and the data section 203 of the program binary. The unresolved reference information is composed of a set of address reference positions that remain unresolved and information of reference destination symbols. In the relocate information 205, there are as many unresolved reference information as the number of address references that remain unresolved.

シンボルテーブル206には、そのプログラムバイナリが持つシンボルの情報が含まれている。シンボル情報は、そのプログラムバイナリの元になるソースコードに含まれていた関数や変数が、プログラムバイナリのどの位置に配置されているのかを表わす情報である。ひとつのシンボル情報は、シンボル文字列と、そのシンボルに対応する関数またはデータが仮想アドレス上で配置される位置、の組からなる。シンボルテーブル206には、そのプログラムバイナリに含まれている数だけのシンボルが含まれている。なお、シンボル情報は、シンボル文字列のかわりに、シンボルを表わすハッシュキーで表現しても良く、またシンボルを含む文字列テーブルへのポインタであっても良い。また、シンボルテーブル206は、そのプログラムバイナリの全てのシンボル情報ではなく、処理に必要な分だけのシンボル情報のみを保持しても良い。   The symbol table 206 includes information on symbols that the program binary has. The symbol information is information indicating where the function or variable included in the source code that is the source of the program binary is located in the program binary. One symbol information consists of a set of a symbol character string and a position where a function or data corresponding to the symbol is arranged on a virtual address. The symbol table 206 includes as many symbols as the number included in the program binary. The symbol information may be expressed by a hash key representing a symbol instead of a symbol character string, or may be a pointer to a character string table including the symbol. Further, the symbol table 206 may hold not only all symbol information of the program binary but only symbol information necessary for processing.

図3は、具体例を用いて、リロケート情報205やシンボルテーブル206の情報を説明した図である。301および302は、それぞれ別個の動的リンクライブラリである。303および304は、それぞれ動的リンクライブラリ301および302のテキストセクションである。305は、関数fへの未解決のアドレス参照である。306は、関数fのテキストである。307は、動的リンクライブラリ301のリロケート情報である。308は、リロケート情報307のうちのひとつの項目であり、305の位置とシンボルfからなる組である。309は、動的リンクライブラリ302のシンボルテーブルである。310は、309のうちのひとつの項目であり、シンボルfと306のアドレスからなる組である。   FIG. 3 is a diagram illustrating information on the relocate information 205 and the symbol table 206 using a specific example. 301 and 302 are separate dynamic link libraries. 303 and 304 are text sections of the dynamic link libraries 301 and 302, respectively. Reference numeral 305 denotes an unresolved address reference to the function f. Reference numeral 306 denotes the text of the function f. Reference numeral 307 denotes relocation information of the dynamic link library 301. Reference numeral 308 denotes one item of the relocate information 307, which is a set of the position 305 and the symbol f. Reference numeral 309 denotes a symbol table of the dynamic link library 302. 310 is one item of 309, and is a set consisting of the addresses of symbols f and 306.

動的リンクライブラリ301には、関数fへの参照が含まれており、その関数fは動的リンクライブラリ302に含まれている。動的リンクライブラリ301の構築時には、関数fが仮想アドレス空間のどの位置に置かれるのかが分からないため、関数fへの参照を未解決のまま残される。これが未解決の参照305である。後に、リロケート処理を行なうときのために、この未解決の情報を記憶しておく必要があり、それが、ひとつのリロケート情報308である。   The dynamic link library 301 includes a reference to the function f, and the function f is included in the dynamic link library 302. When the dynamic link library 301 is constructed, it is not known where in the virtual address space the function f is placed, so that the reference to the function f is left unresolved. This is an unresolved reference 305. This unresolved information needs to be stored for later relocation processing, and this is one relocate information 308.

動的リンクライブラリ302には、関数fが含まれている。別のライブラリ(例えば、動的リンクライブラリ301)などが関数fを参照するときのために、fとその位置が記憶されている必要があり、これがシンボル情報310である。   The dynamic link library 302 includes a function f. In order for another library (for example, the dynamic link library 301) to refer to the function f, it is necessary to store f and its position, and this is the symbol information 310.

図4は、仮想アドレス配置プラン104の内容を示した一例である。401は、仮想アドレス配置プラン104の内容を示したテーブルである。この例では、プログラムバイナリは合計で6個ある。実行可能プログラムがP#1、P#2、P#3の3個であり、動的リンクライブラリがL#1、L#2、L#3の3個である。   FIG. 4 is an example showing the contents of the virtual address arrangement plan 104. 401 is a table showing the contents of the virtual address arrangement plan 104. In this example, there are a total of six program binaries. There are three executable programs P # 1, P # 2, and P # 3, and three dynamic link libraries L # 1, L # 2, and L # 3.

また、ここでは実行可能プログラムP#1が動的リンクライブラリL#1と動的リンクライブラリL#2を使用し、実行可能プログラムP#2が動的リンクライブラリL#1と動的リンクライブラリL#3を使用し、実行可能プログラムP#3が動的リンクライブラリL#1と動的リンクライブラリL#2と動的リンクライブラリL#3を使用するとする。   Here, the executable program P # 1 uses the dynamic link library L # 1 and the dynamic link library L # 2, and the executable program P # 2 is the dynamic link library L # 1 and the dynamic link library L. Assume that # 3 is used and the executable program P # 3 uses the dynamic link library L # 1, the dynamic link library L # 2, and the dynamic link library L # 3.

仮想アドレス配置プランでは、それぞれのプログラムバイナリの開始アドレスと終了アドレスを決める。実行可能プログラムP#1の開始アドレスと終了アドレスはそれぞれa#1とa#2である。実行可能プログラムP#2の開始アドレスと終了アドレスはそれぞれa#1とa#3である。実行可能プログラムP#3の開始アドレスと終了アドレスはそれぞれa#1とa#4である。動的リンクライブラリL#1の開始アドレスと終了アドレスはそれぞれa#4とa#5である。動的リンクライブラリL#2の開始アドレスと終了アドレスはそれぞれa#5とa#6である。動的リンクライブラリL#3の開始アドレスと終了アドレスはそれぞれa#6とa#7である。   In the virtual address arrangement plan, the start address and end address of each program binary are determined. The start address and end address of the executable program P # 1 are a # 1 and a # 2, respectively. The start address and end address of the executable program P # 2 are a # 1 and a # 3, respectively. The start address and end address of the executable program P # 3 are a # 1 and a # 4, respectively. The start address and end address of the dynamic link library L # 1 are a # 4 and a # 5, respectively. The start address and end address of the dynamic link library L # 2 are a # 5 and a # 6, respectively. The start address and end address of the dynamic link library L # 3 are a # 6 and a # 7, respectively.

仮想アドレス配置プランでは、複数の実行可能プログラムが同じ仮想アドレス位置に重複して配置されても良い。複数の実行可能プログラムが同じ仮想アドレス空間上にロードされる事はないため、仮想アドレス配置プラン上で複数の実行可能プログラムが同じ仮想アドレス位置に重複して配置されても問題はない。全ての実行可能プログラムが、仮想アドレス配置プラン上で同じ仮想アドレス位置に配置されると、大量の実行可能プログラムがあっても仮想アドレス空間の領域を必要以上に消費する事はない。なお、複数の実行可能プログラムの仮想アドレス領域が重複しないように配置されても良い。   In the virtual address arrangement plan, a plurality of executable programs may be arranged in duplicate at the same virtual address position. Since a plurality of executable programs are not loaded on the same virtual address space, there is no problem even if a plurality of executable programs are arranged at the same virtual address position on the virtual address arrangement plan. If all the executable programs are arranged at the same virtual address position on the virtual address arrangement plan, the virtual address space area is not consumed more than necessary even if there are a large number of executable programs. Note that virtual address areas of a plurality of executable programs may be arranged so as not to overlap.

動的リンクライブラリの仮想アドレス領域は重複しないように設定される。すなわち、ひとつの動的リンクライブラリが配置されている仮想アドレス領域には、他のプログラムバイナリが配置されないようにする。ひとつのプログラムから複数の動的リンクライブラリが使用される事はあるため、複数の動的リンクライブラリが同じ仮想アドレス空間上にロードされる事はある。複数の動的リンクライブラリが同じ仮想アドレス空間上にロードされる場合、それらが同じ仮想アドレス位置に配置されると競合が生じてしまう。   The virtual link area of the dynamic link library is set not to overlap. In other words, other program binaries are not arranged in the virtual address area where one dynamic link library is arranged. Since a plurality of dynamic link libraries may be used from one program, a plurality of dynamic link libraries may be loaded on the same virtual address space. When multiple dynamic link libraries are loaded on the same virtual address space, contention occurs if they are placed at the same virtual address location.

図5は、前記仮想アドレス配置プラン401に従って、それぞれの実行可能プログラムが実行されたときの、仮想アドレス上でのプログラムバイナリの配置である。   FIG. 5 shows the arrangement of program binaries on virtual addresses when each executable program is executed according to the virtual address arrangement plan 401.

501は、実行可能プログラムP#1が実行されたときの仮想アドレス空間であり、仮想アドレス上でのプログラムバイナリの配置を示している。実行可能プログラムP#1は、動的リンクライブラリL#1と動的リンクライブラリL#2を使用する。前記仮想アドレス配置プラン401に従い、実行可能プログラムP#1の仮想アドレス上での配置は、アドレスa#1からアドレスa#2であり、動的リンクライブラリL#1の開始アドレスと終了アドレスはそれぞれa#4とa#5であり、動的リンクライブラリL#2の開始アドレスと終了アドレスはそれぞれa#5とa#6である。   Reference numeral 501 denotes a virtual address space when the executable program P # 1 is executed, and shows the arrangement of program binaries on the virtual address. The executable program P # 1 uses a dynamic link library L # 1 and a dynamic link library L # 2. According to the virtual address arrangement plan 401, the arrangement of the executable program P # 1 on the virtual address is from the address a # 1 to the address a # 2, and the start address and the end address of the dynamic link library L # 1 are respectively a # 4 and a # 5, and the start address and end address of the dynamic link library L # 2 are a # 5 and a # 6, respectively.

502は、実行可能プログラムP#2が実行されたときの仮想アドレス空間であり、仮想アドレス上でのプログラムバイナリの配置を示している。実行可能プログラムP#2は、動的リンクライブラリL#1と動的リンクライブラリL#3を使用する。前記仮想アドレス配置プラン401に従い、実行可能プログラムP#2の仮想アドレス上での配置は、アドレスa#1からアドレスa#3であり、動的リンクライブラリL#1の開始アドレスと終了アドレスはそれぞれa#4とa#5であり、動的リンクライブラリL#3の開始アドレスと終了アドレスはそれぞれa#6とa#7である。   Reference numeral 502 denotes a virtual address space when the executable program P # 2 is executed, and shows an arrangement of program binaries on the virtual address. The executable program P # 2 uses a dynamic link library L # 1 and a dynamic link library L # 3. According to the virtual address arrangement plan 401, the arrangement of the executable program P # 2 on the virtual address is from the address a # 1 to the address a # 3, and the start address and the end address of the dynamic link library L # 1 are respectively a # 4 and a # 5, and the start address and end address of the dynamic link library L # 3 are a # 6 and a # 7, respectively.

503は、実行可能プログラムP#3が実行されたときの仮想アドレス空間であり、仮想アドレス上でのプログラムバイナリの配置を示している。実行可能プログラムP#3は、動的リンクライブラリL#1と動的リンクライブラリL#2と動的リンクライブラリL#3とを使用する。前記仮想アドレス配置プラン401に従い、実行可能プログラムP#3の仮想アドレス上での配置は、アドレスa#1からアドレスa#4であり、動的リンクライブラリL#1の開始アドレスと終了アドレスはそれぞれa#4とa#5であり、動的リンクライブラリL#2の開始アドレスと終了アドレスはそれぞれa#5とa#6であり、動的リンクライブラリL#3の開始アドレスと終了アドレスはそれぞれa#6とa#7である。   Reference numeral 503 denotes a virtual address space when the executable program P # 3 is executed, and shows an arrangement of program binaries on the virtual address. The executable program P # 3 uses a dynamic link library L # 1, a dynamic link library L # 2, and a dynamic link library L # 3. According to the virtual address arrangement plan 401, the arrangement of the executable program P # 3 on the virtual address is from the address a # 1 to the address a # 4, and the start address and the end address of the dynamic link library L # 1 are respectively a # 4 and a # 5, the start address and end address of the dynamic link library L # 2 are a # 5 and a # 6, respectively, and the start address and end address of the dynamic link library L # 3 are respectively a # 6 and a # 7.

実行可能プログラムP#1、P#2、P#3の仮想アドレス領域は重複している。例えば、実行可能プログラムP#3にはアドレスa#1からアドレスa#4までの領域が割り当てられるが、この領域は、実行可能プログラムP#1が割り当てられるアドレスa#1からアドレスa#2までの領域と重複している。これは、プログラムの実行時に、ひとつの仮想アドレス空間に複数の実行可能プログラムがロードされる事がないためである。プログラムの実行時に、複数の実行可能プログラムが実行される事がないため、実行可能プログラムの仮想アドレス領域が重複していても、仮想アドレス空間上での競合は生じない。   The virtual address areas of the executable programs P # 1, P # 2, and P # 3 overlap. For example, an area from address a # 1 to address a # 4 is allocated to the executable program P # 3, and this area is allocated from address a # 1 to address a # 2 to which the executable program P # 1 is allocated. It overlaps with the area. This is because a plurality of executable programs are not loaded into one virtual address space when the program is executed. Since a plurality of executable programs are not executed when the program is executed, no conflict occurs in the virtual address space even if the virtual address areas of the executable programs overlap.

また、どの実行可能プログラムから使用される場合でも、動的リンクライブラリL#1の仮想アドレス領域はアドレスa#4からアドレスa#5である。(動的リンクライブラリL#2、L#3も同様である。)   In addition, regardless of which executable program is used, the virtual address area of the dynamic link library L # 1 is address a # 4 to address a # 5. (The same applies to the dynamic link libraries L # 2 and L # 3.)

実行可能プログラムP#2は動的リンクライブラリL#2を使用しないため、仮想アドレス空間502のアドレスa#5からアドレスa#6は使用されていない。同様に、仮想アドレス空間501のうちのアドレスa#2からアドレスa#4までの領域なども使用されていない。しかし、この領域は仮想アドレス領域であって、対応する物理メモリ領域が割り当てられるわけではないので、このように仮想アドレス空間で使用していないメモリがあっても、不必要にメモリ使用量を増大させる事はない。   Since the executable program P # 2 does not use the dynamic link library L # 2, the addresses a # 5 to a # 6 in the virtual address space 502 are not used. Similarly, the area from the address a # 2 to the address a # 4 in the virtual address space 501 is not used. However, since this area is a virtual address area and the corresponding physical memory area is not allocated, even if there is memory that is not used in this way, the memory usage is unnecessarily increased. There is nothing to do.

図6は、本実施の形態の仮想アドレス配置プラン生成部105と配置プラン対応リロケータ106による、プログラムバイナリのリロケート処理までのステップを示したフローチャートである。   FIG. 6 is a flowchart showing steps up to the program binary relocation process by the virtual address arrangement plan generation unit 105 and the arrangement plan corresponding relocator 106 according to the present embodiment.

S601で、仮想アドレス配置プラン生成部105が、空の仮想アドレス配置プラン104を生成する。空の仮想アドレス配置プラン104は、どの仮想アドレス領域も予約されていない事を意味する。   In step S <b> 601, the virtual address arrangement plan generation unit 105 generates an empty virtual address arrangement plan 104. An empty virtual address arrangement plan 104 means that no virtual address area is reserved.

S602で、仮想アドレス配置プラン生成部105が、二次記憶装置101からプログラムバイナリ(動的リンクライブラリ102または実行可能プログラム103)をひとつ読み込む。   In step S <b> 602, the virtual address arrangement plan generation unit 105 reads one program binary (dynamic link library 102 or executable program 103) from the secondary storage device 101.

S603で、仮想アドレス配置プラン生成部105が、S601で生成した仮想アドレス配置プラン104に、読み込んだプログラムバイナリのための仮想アドレス情報を追加する。ステップS603の詳細な説明は、図7を用いて後述する。   In S603, the virtual address arrangement plan generation unit 105 adds virtual address information for the read program binary to the virtual address arrangement plan 104 generated in S601. Details of step S603 will be described later with reference to FIG.

S604で、仮想アドレス配置プラン生成部105が、二次記憶装置101から取得する最後のプログラムバイナリなのかを判別する。もし最後のプログラムバイナリならS605に進む。もし最後のプログラムバイナリでないなら、次のプログラムバイナリを読み込む対象にして、S602に戻る。   In step S <b> 604, the virtual address arrangement plan generation unit 105 determines whether it is the last program binary acquired from the secondary storage device 101. If it is the last program binary, the process proceeds to S605. If it is not the last program binary, the next program binary is read and the process returns to S602.

S605で、仮想アドレス配置プラン生成部105が、二次記憶装置101に、ステップS601で生成しS603で配置情報が追加された仮想アドレス配置プラン104を、保存する。   In step S605, the virtual address arrangement plan generation unit 105 stores the virtual address arrangement plan 104 generated in step S601 and added with the arrangement information in step S603 in the secondary storage device 101.

S606で、配置プラン対応リロケータ106が、二次記憶装置101から、プログラムバイナリをひとつ読み込む。ここでは、このプログラムバイナリをBとする。   In S <b> 606, the arrangement plan corresponding relocator 106 reads one program binary from the secondary storage device 101. Here, this program binary is B.

S607で、配置プラン対応リロケータ106が、二次記憶装置101から読み込んだプログラムバイナリ(動的リンクライブラリ102または実行可能プログラム103)をリロケートする。ステップS607の詳細な説明は、図8を用いて後述する。   In S <b> 607, the arrangement plan corresponding relocator 106 relocates the program binary (dynamic link library 102 or executable program 103) read from the secondary storage device 101. Details of step S607 will be described later with reference to FIG.

S608で、配置プラン対応リロケータ106が、二次記憶装置101から取得する最後のプログラムバイナリなのかを判別する。もし最後のプログラムバイナリなら処理が終了する。もし最後のプログラムバイナリでないなら、次のプログラムバイナリを読み込む対象にして、S606に戻る。   In step S <b> 608, it is determined whether the arrangement plan corresponding relocator 106 is the last program binary acquired from the secondary storage device 101. If it is the last program binary, the process ends. If it is not the last program binary, the next program binary is read and the process returns to S606.

図7は、図6のステップS603の内容を示すフローチャートである。   FIG. 7 is a flowchart showing the contents of step S603 in FIG.

S701で、仮想アドレス配置プラン生成部105が、ステップS602で取得したプログラムバイナリの情報を取得する。取得する情報は、そのプログラムバイナリが必要とする仮想アドレス領域の大きさである。   In step S701, the virtual address arrangement plan generation unit 105 acquires the program binary information acquired in step S602. The information to be acquired is the size of the virtual address area required by the program binary.

S702で、仮想アドレス配置プラン生成部105が、ステップS602で取得したプログラムバイナリが実行可能プログラムなのかどうかを判別する。取得したプログラムバイナリが実行可能プログラムの場合、ステップS703に進み、取得したプログラムバイナリが動的リンクライブラリの場合、ステップS704に進む。   In step S702, the virtual address arrangement plan generation unit 105 determines whether the program binary acquired in step S602 is an executable program. If the acquired program binary is an executable program, the process proceeds to step S703. If the acquired program binary is a dynamic link library, the process proceeds to step S704.

S703で、仮想アドレス配置プラン生成部105が、ステップS602で取得した実行可能プログラムを配置する領域を決める。割り当てる領域の大きさは、ステップS701で必要とする仮想アドレス領域の大きさである。割り当てる領域の開始アドレスは、あらかじめ決められている実行可能プログラム用の開始アドレスである。   In step S703, the virtual address arrangement plan generation unit 105 determines an area in which the executable program acquired in step S602 is to be arranged. The size of the area to be allocated is the size of the virtual address area required in step S701. The start address of the area to be allocated is a predetermined start address for an executable program.

S704で、仮想アドレス配置プラン生成部105が、ステップS602で取得した動的リンクライブラリを配置する領域を決める。動的リンクライブラリを割り当てる領域は、仮想アドレス配置プラン104で未使用の領域である。   In step S704, the virtual address arrangement plan generation unit 105 determines an area in which the dynamic link library acquired in step S602 is to be arranged. An area to which the dynamic link library is allocated is an unused area in the virtual address arrangement plan 104.

S705で、仮想アドレス配置プラン生成部105が、ステップS703またはステップS704で決めた、プログラムバイナリを割り当てる仮想アドレス領域を、S601で生成した仮想アドレス配置プラン104に書き込む。   In step S705, the virtual address arrangement plan generation unit 105 writes the virtual address area to which the program binary is allocated, determined in step S703 or step S704, in the virtual address arrangement plan 104 generated in step S601.

図8は、図6のステップS607の内容を示すフローチャートである。   FIG. 8 is a flowchart showing the contents of step S607 in FIG.

S801で、配置プラン対応リロケータ106が、S606で取得したプログラムバイナリBが依存する動的リンクライブラリを全て取得する。特に、ここではS606で取得したプログラムバイナリが直接依存する動的リンクライブラリだけでなく、本ステップで取得された動的リンクライブラリが依存する動的リンクライブラリも、再帰的に取得する。   In S801, the arrangement plan corresponding relocator 106 acquires all the dynamic link libraries on which the program binary B acquired in S606 depends. In particular, here, not only the dynamic link library directly dependent on the program binary acquired in S606 but also the dynamic link library on which the dynamic link library acquired in this step depends is acquired recursively.

S802で、配置プラン対応リロケータ106が、プログラムバイナリBのリロケート情報を取得する。   In S802, the arrangement plan corresponding relocator 106 acquires the relocate information of the program binary B.

S803で、配置プラン対応リロケータ106が、S802で取得したリロケート情報から、ひとつの未解決参照項目を取得する。   In S803, the arrangement plan corresponding relocator 106 acquires one unresolved reference item from the relocate information acquired in S802.

S804で、配置プラン対応リロケータ106が、S803で取得した未解決参照項目を解決するリロケート処理を行なう。S804の詳細な説明は図9を用いて後述する。   In S804, the arrangement plan corresponding relocator 106 performs relocate processing for resolving the unresolved reference item acquired in S803. A detailed description of S804 will be described later with reference to FIG.

S805で、配置プラン対応リロケータ106が、プログラムバイナリから取得する最後の未解決参照項目なのかを判別する。もし最後の未解決参照項目であれば終了し、そうでないなら次の未解決参照項目を対象にしてステップS803に戻る。   In step S805, the arrangement plan corresponding relocator 106 determines whether it is the last unresolved reference item acquired from the program binary. If it is the last unresolved reference item, the process ends. If not, the process returns to step S803 for the next unresolved reference item.

図9は、図8のステップS804の内容を示すフローチャートである。   FIG. 9 is a flowchart showing the contents of step S804 in FIG.

S901で、配置プラン対応リロケータ106が、ステップS803で取得した未解決参照項目から、未解決参照の位置と、参照先のシンボルを取得する。ここで、取得された未解決参照の位置をP、参照先のシンボルをSとする。   In S901, the arrangement plan corresponding relocator 106 acquires the position of the unresolved reference and the reference destination symbol from the unresolved reference item acquired in Step S803. Here, it is assumed that the position of the acquired unresolved reference is P, and the reference destination symbol is S.

S902で、配置プラン対応リロケータ106が、ステップS801で取得した、プログラムバイナリBが依存する動的リンクライブラリのうちの、ひとつの動的リンクライブラリを取得する。ここでは、この動的リンクライブラリをLとする。   In S902, the arrangement plan corresponding relocator 106 acquires one dynamic link library among the dynamic link libraries on which the program binary B acquired in step S801 depends. Here, let this dynamic link library be L.

S903で、配置プラン対応リロケータ106が、動的リンクライブラリLのシンボルテーブルを取得する。ここでは、このシンボルテーブルをTとする。   In S903, the relocation locator 106 acquires the symbol table of the dynamic link library L. Here, this symbol table is T.

S904で、配置プラン対応リロケータ106が、シンボルテーブルTに、S901で取得したシンボルSが含まれているかを判別する。もし含まれていれば、S904に進む。もし含まれていなければ、次の動的リンクライブラリを調べる対象にして、ステップS902に戻る。   In S904, the arrangement plan corresponding relocator 106 determines whether the symbol S acquired in S901 is included in the symbol table T. If it is included, the process proceeds to S904. If it is not included, the next dynamic link library is examined, and the process returns to step S902.

S905で、配置プラン対応リロケータ106が、シンボルSに対応するアドレスをシンボルテーブルTから取得し、ステップS901で取得された未解決参照位置Pに書き込む。   In S905, the arrangement plan corresponding relocator 106 acquires the address corresponding to the symbol S from the symbol table T, and writes it in the unresolved reference position P acquired in step S901.

図10は、配置プラン対応ローダ107の処理ステップを示したフローチャートである。   FIG. 10 is a flowchart showing processing steps of the arrangement plan corresponding loader 107.

配置プラン対応ローダ107は、実行中のプログラム等から、特定の実行可能プログラムまたは動的リンクライブラリをロードする要求を受けて起動される。   The arrangement plan corresponding loader 107 is activated in response to a request to load a specific executable program or dynamic link library from a program being executed.

配置プラン対応ローダ107は、配置プラン対応リロケータ106がリロケートしたプログラムバイナリ(実行可能プログラム103または動的リンクライブラリ102)を二次記憶装置101から読み込み、ロード対象のプログラムバイナリと同じプログラムバイナリが既にロードされている場合はそのコードを共有し、そうでない場合は、仮想アドレス配置プラン生成部105が生成した仮想アドレス配置プラン104に従った仮想アドレス上での位置に、プログラムバイナリをロードする。以下で詳細なステップを説明する。   The placement plan loader 107 reads the program binary (executable program 103 or dynamic link library 102) relocated by the placement plan support relocator 106 from the secondary storage device 101, and the same program binary as the program binary to be loaded is already loaded. If it is, the code is shared. If not, the program binary is loaded at a position on the virtual address according to the virtual address arrangement plan 104 generated by the virtual address arrangement plan generation unit 105. Detailed steps are described below.

配置プラン対応ローダ107は、プログラムバイナリを受け取って起動される。ここでは、このプログラムバイナリをBとする。   The arrangement plan corresponding loader 107 receives the program binary and is activated. Here, this program binary is B.

ステップS1001で、配置プラン対応ローダ107は、プログラムバイナリBが既にロードされているかどうかを判別する。既にロードされている場合、ステップS1003に進む。未だにロードされていない場合、ステップS1002に進む。   In step S1001, the arrangement plan corresponding loader 107 determines whether or not the program binary B has already been loaded. If already loaded, the process proceeds to step S1003. If it has not been loaded yet, the process proceeds to step S1002.

ステップS1002で、配置プラン対応ローダ107は、プログラムバイナリBのテキストセクションをロードする。このとき、ロードするアドレスは仮想アドレス配置プラン104に従う。この後、ステップS1004に進む。   In step S1002, the arrangement plan corresponding loader 107 loads the text section of the program binary B. At this time, the address to be loaded follows the virtual address arrangement plan 104. Thereafter, the process proceeds to step S1004.

ステップS1003で、配置プラン対応ローダ107は、既に別のプロセス等によってロードされているプログラムバイナリBのテキストセクションを共有する。仮想メモリ機構を備えたコンピュータシステムでは、仮想アドレス領域と特定の物理アドレス領域を対応づける事ができ、仮想アドレス領域にアクセスすると実際のアクセスが物理アドレス領域に対して行なわれる。あるメモリ領域を共有するとき、それぞれの仮想アドレス領域が同じ物理アドレス領域に対応づける。この後、ステップS1004に進む。   In step S1003, the arrangement plan corresponding loader 107 shares the text section of the program binary B that has already been loaded by another process or the like. In a computer system provided with a virtual memory mechanism, a virtual address area can be associated with a specific physical address area, and when the virtual address area is accessed, actual access is performed to the physical address area. When a certain memory area is shared, each virtual address area is associated with the same physical address area. Thereafter, the process proceeds to step S1004.

ステップS1004で、配置プラン対応ローダ107は、プログラムバイナリのデータセクションをロードする。このとき、動的リンクライブラリをロードするアドレスは、仮想アドレス配置プランに従う。   In step S1004, the arrangement plan corresponding loader 107 loads the data section of the program binary. At this time, the address for loading the dynamic link library follows the virtual address arrangement plan.

テキスト領域とは異なり、データ領域とbss領域は、それぞれのプロセスが固有の情報を書き込む事ができる。したがって、一般に、データ領域やbss領域はプロセス間で共有する事ができない。なお、データ領域であっても、書き込みが行なわれるまでは共有する事が可能であるため、書き込みが行なわれるまで、複数のプロセスの間でデータ領域を共有しても良い。   Unlike the text area, each process can write unique information in the data area and the bss area. Therefore, generally, the data area and the bss area cannot be shared between processes. Note that even the data area can be shared until writing is performed, so the data area may be shared among a plurality of processes until writing is performed.

ステップS1005で、配置プラン対応ローダ107は、プログラムバイナリBのbssセクションをロードする。このとき、bssセクションをロードするアドレスは、仮想アドレス配置プラン104に従う。   In step S1005, the arrangement plan corresponding loader 107 loads the bss section of the program binary B. At this time, the address for loading the bss section follows the virtual address arrangement plan 104.

ステップS1006で、配置プラン対応ローダ107は、プログラムバイナリBが依存する動的リンクライブラリを全て再帰的にロードする。   In step S1006, the arrangement plan corresponding loader 107 recursively loads all the dynamic link libraries on which the program binary B depends.

本実施の形態にかかる動的リンクライブラリ処理装置を用いると、それぞれの動的リンクライブラリがロードされる仮想アドレスが常に一定に定まる。したがって、ある動的リンクライブラリから別の動的リンクライブラリの情報を参照する場合、参照先の情報が置かれている仮想アドレス上での位置が確定する。この事から、それぞれの動的リンクライブラリのうちの未解決の参照を事前に解決しておく事ができる。   When the dynamic link library processing apparatus according to the present embodiment is used, the virtual address at which each dynamic link library is loaded is always fixed. Therefore, when referring to information of another dynamic link library from a certain dynamic link library, the position on the virtual address where the reference destination information is placed is determined. From this, unresolved references in each dynamic link library can be resolved in advance.

例えば、図5の仮想アドレス空間501、502、503のいずれでも、動的リンクライブラリL#1は、アドレスa#4からアドレスa#5に配置される。したがって、動的リンクライブラリL#1内にある関数やデータなどが置かれているアドレスは常に一定である。したがって、ある別のプログラムバイナリから、動的リンクライブラリL#1内の関数やデータへのアドレス参照があったとき、その関数やデータのアドレスは事前に決定できる。この事から、プログラムバイナリ間でのアドレス参照であっても、事前にリロケートする事ができる。   For example, in any of the virtual address spaces 501, 502, and 503 in FIG. 5, the dynamic link library L # 1 is arranged from the address a # 4 to the address a # 5. Therefore, the addresses where the functions and data in the dynamic link library L # 1 are placed are always constant. Therefore, when there is an address reference to a function or data in the dynamic link library L # 1 from another program binary, the address of the function or data can be determined in advance. Therefore, even if the address is referenced between program binaries, it can be relocated in advance.

また、それぞれの動的リンクライブラリがロードされる仮想アドレスが常に一定である事から、GOTなどのバイナリインタフェースを経由する事なく、異なる動的リンクライブラリにアクセスするような、位置に依存するコードを使用する事ができる。位置依存コードは、GOTを使用する位置独立コードよりも実行効率が高い。   Also, since the virtual address at which each dynamic link library is loaded is always constant, code that depends on the location that accesses different dynamic link libraries without going through a binary interface such as GOT can be used. Can be used. Position-dependent code is more efficient than position-independent code using GOT.

以上により、本実施の形態にかかる動的リンクライブラリ処理装置を用いると、仮想メモリ機構を使用するマルチプロセス環境においてライブラリのコードを複数の仮想アドレス空間で共有する事ができ、かつ、仮想アドレスの位置に依存するコードを用いる事ができる。ライブラリのコードは共有されるため、メモリ使用効率が良い。また、アドレスの位置に依存するコードであるため、アドレス参照で直接参照を使用する事ができ、実行効率が向上する。   As described above, when the dynamically linked library processing apparatus according to the present embodiment is used, the library code can be shared by a plurality of virtual address spaces in a multi-process environment using a virtual memory mechanism, and the virtual address You can use position-dependent code. Since the library code is shared, memory use efficiency is good. In addition, since the code depends on the address position, direct reference can be used for address reference, and execution efficiency is improved.

従来の静的リンク方式でも、従来のGOTを用いた動的リンク方式でも、プログラムを実行するために、それぞれのプログラムバイナリの配置プランを生成する。   In either the conventional static link method or the conventional dynamic link method using GOT, an arrangement plan for each program binary is generated in order to execute the program.

従来の静的リンク方式では、あるアドレス領域にプログラムバイナリを割り当てると、その領域に他のプログラムバイナリを重複して割り当てる事ができない。また、静的リンク方式では、ライブラリのコードは実行可能プログラムにコピーされるため、異なるプログラム間で共有する事ができない。本実施の形態の動的リンクライブラリ処理装置では、実行可能プログラムを割り当てる仮想アドレス領域は重複させる事ができる。また、ライブラリは動的リンクライブラリとして異なるプログラム間で共有する事ができる。例えば、図5の仮想アドレス空間501と、502を考える。実行可能プログラムP#1とP#2は同じ仮想アドレス領域に重複して割り当てられている。また、動的リンクライブラリL#1は実行可能プログラムP#1およびP#2から共有される。   In the conventional static link method, when program binaries are assigned to a certain address area, other program binaries cannot be assigned to that area. In the static linking method, the library code is copied to the executable program and cannot be shared between different programs. In the dynamic link library processing apparatus according to the present embodiment, virtual address areas to which executable programs are assigned can be overlapped. A library can be shared between different programs as a dynamic link library. For example, consider the virtual address spaces 501 and 502 of FIG. Executable programs P # 1 and P # 2 are assigned to the same virtual address area. The dynamic link library L # 1 is shared by the executable programs P # 1 and P # 2.

従来のGOT等を用いた動的リンク方式では、動的リンクライブラリが配置される仮想アドレス領域がプログラムごとに異なっていた。動的リンクライブラリが異なる仮想アドレス領域に配置されるときに、動的リンクライブラリが位置依存のコードを含むと、プログラム間で動的リンクライブラリのコードを共有できなくなってしまう。本実施の形態の動的リンクライブラリ装置を用いた方式では、全てのプログラムで共通する仮想アドレス配置プランを使用する事により、ある動的リンクライブラリがロードされる仮想アドレス領域は、どのプログラムでも共通となる。したがって、それぞれの動的リンクライブラリがロードされる位置が常に決まっているため、位置依存コードを使用しても、動的リンクライブラリのコードをプログラム間で共有する事ができる。   In the conventional dynamic link method using GOT or the like, the virtual address area in which the dynamic link library is arranged is different for each program. If the dynamic link library includes position-dependent code when the dynamic link library is arranged in different virtual address areas, the code of the dynamic link library cannot be shared between programs. In the method using the dynamic link library apparatus of the present embodiment, a virtual address area loaded with a dynamic link library is common to all programs by using a virtual address allocation plan common to all programs. It becomes. Therefore, since the position where each dynamic link library is loaded is always determined, the code of the dynamic link library can be shared between programs even if position dependent code is used.

(実施の形態2)
図11は、本発明の実施の形態2における動的リンクライブラリ処理装置の構成を示す図である。図11において、図1と同じ構成については同じ符号を用い、説明を省略する。
(Embodiment 2)
FIG. 11 is a diagram showing a configuration of the dynamic link library processing apparatus according to the second embodiment of the present invention. In FIG. 11, the same components as those in FIG.

ストリッパ1101は、配置プラン対応リロケータ106によってリロケートされた動的リンクライブラリ102または実行可能プログラム103から、リロケートに必要なシンボル情報およびリロケート情報を削除するストリッパである。   The stripper 1101 is a stripper that deletes symbol information and relocate information necessary for relocation from the dynamic link library 102 or the executable program 103 relocated by the arrangement plan corresponding relocator 106.

図2のリロケート情報205およびシンボルテーブル206は、リロケートに必要な情報である。これらの情報は、リロケートが完了すると不要になる事がある。ストリッパ1101は、これらの不要なものを削除し、プログラムバイナリのサイズを縮小させ、効率化を図る。   The relocate information 205 and the symbol table 206 in FIG. 2 are information necessary for relocation. This information may become unnecessary once the relocation is complete. The stripper 1101 deletes these unnecessary ones, reduces the size of the program binary, and improves efficiency.

図12は、ストリッパ1101が、プログラムバイナリのリロケート情報205およびシンボルテーブル206を削除する処理ステップを示したフローチャートである。   FIG. 12 is a flowchart showing processing steps in which the stripper 1101 deletes the program binary relocate information 205 and the symbol table 206.

S1201で、ストリッパ1101が、二次記憶装置101から、プログラムバイナリ(実行可能プログラム103または動的リンクライブラリ102)をひとつ取得する。ここでは、取得したプログラムバイナリをBとする。   In step S <b> 1201, the stripper 1101 acquires one program binary (the executable program 103 or the dynamic link library 102) from the secondary storage device 101. Here, it is assumed that the acquired program binary is B.

S1202で、ストリッパ1101が、プログラムバイナリBの中にあるリロケート情報205を取得し、これを削除する。   In S1202, the stripper 1101 acquires the relocate information 205 in the program binary B and deletes it.

S1203で、ストリッパ1101が、プログラムバイナリBの中にあるシンボルテーブル206を取得し、これを削除する。   In step S1203, the stripper 1101 acquires the symbol table 206 in the program binary B and deletes it.

S1204で、ストリッパ1101が、リロケート情報205およびシンボルテーブル206が削除されたプログラムバイナリを、二次記憶装置101に保存する。   In step S <b> 1204, the stripper 1101 stores the program binary from which the relocate information 205 and the symbol table 206 are deleted in the secondary storage device 101.

S1205で、ストリッパ1101は、プログラムバイナリBが取得できる最後のプログラムバイナリかどうかを判別する。最後のプログラムバイナリの場合、処理は終了する。最後のプログラムバイナリでない場合、次のプログラムバイナリを処理対象にしてS1201に戻る。   In step S1205, the stripper 1101 determines whether the program binary B is the last program binary that can be acquired. For the last program binary, the process ends. If it is not the last program binary, the next program binary is targeted for processing, and the flow returns to S1201.

従来のGOTを用いた動的リンクライブラリ技術の場合、動的リンクライブラリのロード時にGOTを生成するために、シンボルテーブルやリロケート情報を動的リンクライブラリ内に残しておく必要があった。本実施の形態にかかる動的リンクライブラリ処理装置を用いると、実行可能プログラムや動的リンクライブラリのリロケート処理が完了し、リロケート情報などがなくてもプログラムが適切にロードできるようになる。したがって、本実施の形態にかかる動的リンクライブラリ処理装置では、不要なリロケート情報やシンボルテーブルを削除し、プログラムバイナリのサイズを縮小し、効率化を図る事ができる。   In the case of the dynamic link library technology using the conventional GOT, it is necessary to leave the symbol table and relocate information in the dynamic link library in order to generate the GOT when the dynamic link library is loaded. When the dynamic link library processing apparatus according to the present embodiment is used, the relocate process of the executable program and the dynamic link library is completed, and the program can be loaded properly without the relocate information. Therefore, in the dynamic link library processing apparatus according to the present embodiment, unnecessary relocate information and symbol tables can be deleted, the size of the program binary can be reduced, and efficiency can be improved.

(実施の形態3)
図13は、本発明の実施の形態3における動的リンクライブラリ処理装置の構成を示す図である。図13において、図1と同じ構成については同じ符号を用い、説明を省略する。
(Embodiment 3)
FIG. 13 is a diagram showing a configuration of the dynamic link library processing apparatus according to the third embodiment of the present invention. In FIG. 13, the same components as those in FIG.

1301は、仮想アドレス領域の確保と解放を行なうメモリマネージャであり、実行中のプログラムから仮想アドレス領域を確保する要求を受けて処理を開始する。   A memory manager 1301 secures and releases a virtual address area, and starts processing upon receiving a request to secure a virtual address area from a running program.

確保済みメモリ領域テーブル1302は、メモリマネージャ1301が、確保した領域を記憶しておくために使用するテーブルである。確保済みメモリ領域テーブル1302は初期状態では空の状態である。   The reserved memory area table 1302 is a table used by the memory manager 1301 to store the reserved area. The reserved memory area table 1302 is empty in the initial state.

メモリマネージャ1301は、実行中のプログラムから仮想アドレス領域の確保要求を受けたとき、仮想アドレス配置プラン104を参照し、仮想アドレス配置プラン104で割り当てられていない仮想アドレス領域を使用しないよう、メモリ確保を行なう。   When the memory manager 1301 receives a request for securing a virtual address area from a running program, the memory manager 1301 refers to the virtual address allocation plan 104 and secures the memory so as not to use a virtual address area not allocated in the virtual address allocation plan 104. To do.

図14は、メモリマネージャ1301がメモリを確保するときの処理ステップを示したフローチャートである。   FIG. 14 is a flowchart showing processing steps when the memory manager 1301 secures memory.

ステップS1401で、メモリマネージャ1301は、実行中のプログラムから仮想アドレスの領域を確保する要求を受けて処理を開始する。確保要求では、確保するメモリの容量が指定される。   In step S1401, the memory manager 1301 starts processing upon receiving a request to secure a virtual address area from the program being executed. In the securing request, the memory capacity to be secured is specified.

ステップS1402で、メモリマネージャ1301は、二次記憶装置101から仮想アドレス配置プラン104を読み込み、仮想アドレス配置プラン104でプログラムバイナリ用に割り当てられている仮想アドレス領域を取得する。   In step S1402, the memory manager 1301 reads the virtual address allocation plan 104 from the secondary storage device 101, and acquires the virtual address area allocated for the program binary in the virtual address allocation plan 104.

ステップS1403で、メモリメネージャ1301は、確保済みメモリ領域テーブル1302を調べ、割り当てられている仮想アドレス領域を取得する。   In step S1403, the memory manager 1301 checks the reserved memory area table 1302 and acquires the allocated virtual address area.

ステップS1404で、メモリメネージャ1301は、ステップS1402およびステップS1403の両方で割り当てられていない仮想アドレス領域を確保し、確保済みメモリ領域テーブル1302に割り当てた領域として書き込む。   In step S1404, the memory manager 1301 secures a virtual address area that is not allocated in both step S1402 and step S1403, and writes it as an allocated area in the reserved memory area table 1302.

ステップS1405で、メモリマネージャ1301は、ステップS1404で確保した仮想アドレス領域をプログラムに通知して終了する。   In step S1405, the memory manager 1301 notifies the program of the virtual address area secured in step S1404 and ends.

一般に、あるプログラムが実行するとき、全ての動的リンクライブラリは使用されず、一部の動的リンクライブラリのみが使用される。また、あるプログラムが使用する動的リンクライブラリであっても、プログラムの起動時にロードせず、実行中に必要に応じてその場でロードする事も可能である。したがって、あるプログラムが実行するとき、仮想アドレス配置プランに含まれている全ての仮想アドレス領域が使用されるわけではなく、実行中のプログラムが使用していない動的リンクライブラリのための仮想アドレス領域は未使用のまま残っている事になる。   In general, when a program is executed, not all dynamic link libraries are used, but only some dynamic link libraries are used. Even a dynamic link library used by a program can be loaded on the spot as needed during execution without being loaded when the program is started. Therefore, when a program is executed, not all virtual address areas included in the virtual address allocation plan are used, but a virtual address area for a dynamic link library that is not used by the program being executed. Will remain unused.

動的リンクライブラリは実行時にリンクする事が可能であるため、プログラムの処理が進んだ後に動的リンクライブラリが使用されるようになる可能性がある。動的リンクライブラリが使用されるようになったときに、その動的リンクライブラリのための仮想アドレス領域が他の用途で使用されていると、仮想アドレス配置プランに示されている位置に動的リンクライブラリを配置できない。そこで、本実施の形態のメモリメネージャは、メモリ確保要求を受け取ったときに、仮想アドレス配置プランに示されていない仮想アドレス領域を確保して割り当てる。この結果、仮想アドレス配置プランで割り当てられている仮想アドレス領域が、他の用途で使用される事がなく、動的リンクライブラリを適切な位置にロードする事を保証できる。   Since the dynamic link library can be linked at the time of execution, the dynamic link library may be used after the processing of the program proceeds. When the dynamic link library is used, if the virtual address area for the dynamic link library is used for other purposes, the dynamic link library is dynamically moved to the location indicated in the virtual address allocation plan. The link library cannot be placed. Therefore, the memory manager according to the present embodiment secures and allocates a virtual address area not shown in the virtual address arrangement plan when receiving a memory reservation request. As a result, the virtual address area allocated in the virtual address arrangement plan is not used for other purposes, and it can be guaranteed that the dynamic link library is loaded at an appropriate position.

本発明にかかる動的リンクライブラリ処理装置は、仮想メモリ機構を用いるコンピュータシステムにおいて、位置依存コードを用いても動的リンクライブラリのコードの共有を可能とする。動的リンクライブラリのコードが複数のプロセスで共有されるため、メモリ消費量が少なく、また実行効率の高い位置依存コードを用いる事ができるため、プログラムの実行効率も向上し、有用である。   The dynamic link library processing apparatus according to the present invention enables sharing of the code of the dynamic link library in a computer system using a virtual memory mechanism even if position dependent code is used. Since the code of the dynamic link library is shared by a plurality of processes, the memory consumption is small and the position-dependent code with high execution efficiency can be used. Therefore, the execution efficiency of the program is improved and useful.

本発明の実施の形態1における動的リンクライブラリ処理装置の構成を示す図である。It is a figure which shows the structure of the dynamic link library processing apparatus in Embodiment 1 of this invention. ひとつの実行可能プログラムまたは動的リンクライブラリに含まれる情報を示す図である。It is a figure which shows the information contained in one executable program or a dynamic link library. 具体例を用いて、リロケート情報205やシンボルテーブル206の情報を説明した図である。It is the figure explaining the information of the relocate information 205 and the symbol table 206 using a specific example. 仮想アドレス配置プラン104の内容を示した一例である。It is an example which showed the content of the virtual address arrangement plan 104. FIG. 前記仮想アドレス配置プラン401に従って、それぞれの実行可能プログラムが実行されたときの、仮想アドレス上でのプログラムバイナリの配置の図である。It is a figure of arrangement | positioning of the program binary on a virtual address when each executable program is executed according to the said virtual address arrangement plan 401. FIG. 図1の仮想アドレス配置プラン生成部105と配置プラン対応リロケータ106による、プログラムバイナリのリロケート処理までのステップを示したフローチャートである。2 is a flowchart showing steps up to a program binary relocation process by a virtual address arrangement plan generation unit 105 and an arrangement plan corresponding relocator 106 in FIG. 1. 図6のステップS603の内容を示すフローチャートである。It is a flowchart which shows the content of step S603 of FIG. 図6のステップS607の内容を示すフローチャートである。It is a flowchart which shows the content of step S607 of FIG. 図8のステップS804の内容を示すフローチャートである。It is a flowchart which shows the content of step S804 of FIG. 配置プラン対応ローダ107の処理ステップを示したフローチャートである。It is the flowchart which showed the processing step of the arrangement plan corresponding loader. 本発明の実施の形態2における動的リンクライブラリ処理装置の構成を示す図である。It is a figure which shows the structure of the dynamic link library processing apparatus in Embodiment 2 of this invention. ストリッパ1101が、プログラムバイナリのリロケート情報205およびシンボルテーブル206を削除する処理ステップを示したフローチャートである。It is the flowchart which showed the process step which the stripper 1101 deletes the relocate information 205 and the symbol table 206 of a program binary. 本発明の実施の形態3における動的リンクライブラリ処理装置の構成を示す図である。It is a figure which shows the structure of the dynamic link library processing apparatus in Embodiment 3 of this invention. メモリマネージャ1301がメモリを確保するときの処理ステップを示したフローチャートである。It is the flowchart which showed the processing step when the memory manager 1301 reserves a memory.

符号の説明Explanation of symbols

101 二次記憶装置
102 動的リンクライブラリ
103 実行可能プログラム
104 仮想アドレス配置プラン
105 仮想アドレス配置プラン生成部
106 配置プラン対応リロケータ
107 配置プラン対応ローダ
108 メモリ
201 ヘッダ情報
202 テキストセクション
203 データセクション
204 bssセクション
205 リロケート情報
206 シンボルテーブル
301 動的リンクライブラリ
302 動的リンクライブラリ
303 テキストセクション
304 テキストセクション
305 未解決の参照
306 関数のテキスト
307 リロケート情報
308 リロケート情報
309 シンボルテーブル
310 シンボル情報
401 仮想アドレス配置プラン
501 仮想アドレス空間
502 仮想アドレス空間
503 仮想アドレス空間
1101 ストリッパ
1301 メモリマネージャ
1302 確保済みメモリ領域テーブル
DESCRIPTION OF SYMBOLS 101 Secondary storage device 102 Dynamic link library 103 Executable program 104 Virtual address arrangement plan 105 Virtual address arrangement plan production | generation part 106 Placement plan corresponding relocator 107 Placement plan corresponding loader 108 Memory 201 Header information 202 Text section 203 Data section 204 BSS section 205 Relocate Information 206 Symbol Table 301 Dynamic Link Library 302 Dynamic Link Library 303 Text Section 304 Text Section 305 Unresolved Reference 306 Function Text 307 Relocate Information 308 Relocate Information 309 Symbol Table 310 Symbol Information 401 Virtual Address Placement Plan 501 Virtual Address space 502 Virtual address space 503 Virtual address Space 1101 Stripper 1301 Memory manager 1302 Reserved memory area table

Claims (3)

仮想メモリ機構を用いるコンピュータシステムにおいて、
一つ以上の実行可能プログラムと一つ以上の動的リンクライブラリとを受け取り、動的リンクライブラリが重複しないように、前記一つ以上の動的リンクライブラリおよび前記一つ以上の実行可能プログラムの仮想アドレス上での配置を決定することにより、前記一つ以上の動的リンクライブラリおよび前記一つ以上の実行可能プログラムの仮想アドレス上での配置位置を示す仮想アドレス配置プランを生成する仮想アドレス配置プラン生成部と、
前記一つ以上の実行可能プログラムと前記一つ以上の動的リンクライブラリとを受け取り、それぞれの実行可能プログラムと動的リンクライブラリを、プログラムの実行以前に、前記仮想アドレス配置プランに基づいてリロケートする配置プラン対応リロケータと、
プログラムの実行時に、前記配置プラン対応リロケータがリロケートした実行可能プログラムおよび動的リンクライブラリを受け取り、ロード対象の実行可能プログラムまたは動的リンクライブラリが実行しているプログラムと異なる仮想アドレス空間に既にロードされている場合はそのコードを共有し、そうでない場合は前記仮想アドレス配置プランに従った仮想アドレス上での位置に、実行可能プログラムまたは動的リンクライブラリをロードする配置プラン対応ローダと、
を備える事を特徴とする動的リンクライブラリ処理装置。
In a computer system using a virtual memory mechanism,
One or more executable programs and one or more dynamic link libraries are received, and the one or more dynamic link libraries and the one or more executable programs are virtual so that the dynamic link libraries do not overlap. A virtual address arrangement plan for generating a virtual address arrangement plan indicating an arrangement position on a virtual address of the one or more dynamic link libraries and the one or more executable programs by determining an arrangement on the address A generator,
The one or more executable programs and the one or more dynamic link libraries are received, and the respective executable programs and dynamic link libraries are relocated based on the virtual address allocation plan before the execution of the programs. A relocation locator
When the program is executed, the relocation locator corresponding to the arrangement plan receives the relocated executable program and dynamic link library, and is already loaded in a different virtual address space from the program being executed by the loadable executable program or dynamic link library. A placement plan compatible loader that loads an executable program or a dynamic link library at a location on a virtual address according to the virtual address placement plan otherwise.
A dynamic link library processing apparatus characterized by comprising:
前記配置プラン対応リロケータによってリロケートされた実行可能プログラムまたは動的リンクライブラリを受け取り、それぞれの実行可能プログラムまたは動的リンクライブラリの中の、シンボル情報およびリロケート情報を削除するストリッパ、
を更に備える事を特徴とする請求項1記載の動的リンクライブラリ処理装置。
A stripper for receiving the executable program or the dynamic link library relocated by the arrangement plan corresponding relocator and deleting the symbol information and the relocate information in each executable program or the dynamic link library;
The dynamic link library processing apparatus according to claim 1, further comprising:
前記仮想アドレス配置プランを受け取り、仮想アドレス上のメモリ領域を確保するときに、前記仮想アドレス配置プランによって示されている仮想アドレス領域以外からメモリ確保を行なうメモリマネージャ、
を更に備える事を特徴とする請求項1または請求項2記載の動的リンクライブラリ処理装置。
A memory manager that receives the virtual address arrangement plan and secures a memory area other than the virtual address area indicated by the virtual address arrangement plan when securing a memory area on the virtual address;
The dynamic link library processing apparatus according to claim 1, further comprising:
JP2004229555A 2004-08-05 2004-08-05 Dynamic link library processor Pending JP2006048431A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004229555A JP2006048431A (en) 2004-08-05 2004-08-05 Dynamic link library processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004229555A JP2006048431A (en) 2004-08-05 2004-08-05 Dynamic link library processor

Publications (1)

Publication Number Publication Date
JP2006048431A true JP2006048431A (en) 2006-02-16

Family

ID=36026906

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004229555A Pending JP2006048431A (en) 2004-08-05 2004-08-05 Dynamic link library processor

Country Status (1)

Country Link
JP (1) JP2006048431A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010225099A (en) * 2009-03-25 2010-10-07 Canon Inc Information processing apparatus, method for controlling the same, and program
JP2018511132A (en) * 2015-12-25 2018-04-19 バイドゥ オンライン ネットワーク テクノロジー (ベイジン) カンパニー リミテッド Application loading method and apparatus
JP2020113050A (en) * 2019-01-11 2020-07-27 日本電気株式会社 Dynamic link device, dynamic load device, computer system, dynamic link method, dynamic load method, dynamic link program, and dynamic load program

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010225099A (en) * 2009-03-25 2010-10-07 Canon Inc Information processing apparatus, method for controlling the same, and program
JP2018511132A (en) * 2015-12-25 2018-04-19 バイドゥ オンライン ネットワーク テクノロジー (ベイジン) カンパニー リミテッド Application loading method and apparatus
JP2020113050A (en) * 2019-01-11 2020-07-27 日本電気株式会社 Dynamic link device, dynamic load device, computer system, dynamic link method, dynamic load method, dynamic link program, and dynamic load program
JP7271957B2 (en) 2019-01-11 2023-05-12 日本電気株式会社 Dynamic link device, dynamic load device, computer system, dynamic link method, dynamic load method, dynamic link program, and dynamic load program

Similar Documents

Publication Publication Date Title
US6484309B2 (en) Enabling software designed for one operating system to operate on another operating system
US8726257B2 (en) File attributes for flexible linking
US6993754B2 (en) Annotations to executable images for improved dynamic optimization functions
KR101761650B1 (en) Sharing virtual functions in a shared virtual memory between heterogeneous processors of a computing platform
JP5039031B2 (en) Method and apparatus for executing native code and target code in combination during program code conversion
US20110153957A1 (en) Sharing virtual memory-based multi-version data between the heterogenous processors of a computer platform
EP3267308B1 (en) Application loading method and device
JPH0836488A (en) Method and device for checking run-time error using dynamic patching
US9507613B2 (en) Methods and apparatus for dynamically preloading classes
US5553286A (en) System and method for preparing a computer program for execution
JP2009059349A (en) Shared type java (r) jar file
US20080034359A1 (en) Software transactional protection of managed pointers
CA1319439C (en) System for processing data to facilitate the creation of executable images
CN111399990A (en) Method and device for interpreting and executing intelligent contract instruction
JP2000347876A (en) Method and device for stack slot allocation
US7769962B2 (en) System and method for thread creation and memory management in an object-oriented programming environment
JP2006323844A (en) System and method for reducing execution time of bytecode in java (r) virtual machine
CN103140834A (en) Processor support for filling memory regions
JP2006048431A (en) Dynamic link library processor
JP4500040B2 (en) COMPILER PROGRAM, COMPUTER-READABLE RECORDING MEDIUM CONTAINING COMPILER PROGRAM, COMPILING METHOD, AND COMPILING DEVICE
CN113821272B (en) Application program running method, computing device and storage medium
KR101140522B1 (en) System and Method for Managing Object
CN113961485A (en) Memory optimization method, device, terminal and storage medium
JP2004078604A (en) Information processing method and program for executing the same method and recording medium
KR100727627B1 (en) Method for supporting application using dynamic linking library and system using the method