IP Library Granted Patent US 9,354,947
Granted Patent B2
US 9,354,947 · App. 14/525,680 · Granted May 31, 2016

Linking a function with dual entry points

Inventors: Michael Karl Gschwind (Chappaqua, NY); Ulrich Weigand (Holzgerlingen, DE)
Assignee: International Business Machines Corporation
G06F9/54G06F9/466
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,354,947
App. No.
14/525,680
Granted
May 31, 2016
Kind
B2
Abstract

A method for a static linker to resolve a function call can include identifying, during link time, a first function call of a calling function to a callee function, determining whether the callee function is a local function, determining whether the callee function has a plurality of entry points, and whether an entry point of the plurality of entry points is a local entry point. The method can include resolving, during link time, the first function call to enter the local entry point, which can include replacing a symbol for the function in the first function call with an address of the local entry point during link time. If the callee function cannot be determined to be a local function, the method can include generating stub code and directing the first function call to enter the stub code during link time.

Claims (35)

1. A computer program product for a static linker to resolve a function call, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions readable by a computer processor to cause the computer processor to:

identify, during link time, a first function call of a calling function to a callee function;

determine whether the callee function is a local function;

in response to determining that the callee function is a local function, determine whether the callee function has a plurality of entry points and whether an entry point of the plurality of entry points is a local entry point, the determining of whether the callee function has a plurality of entry points and whether an entry point of the plurality of entry points is a local entry point including accessing symbol information from a symbol table, the symbol table indicating a number of entry points and whether an entry point is a local entry point; and

resolve, during link time, the first function call to enter the local entry point when it is determined that the callee function has a plurality of entry points and an entry point of the plurality of entry points is the local entry point,

wherein the resolving of the first function call to enter the local entry point includes replacing a symbol for the callee function in the first function call with an address of the local entry point during link time.

2. The computer program product of claim 1 , further comprising:

in response to determining that the callee function cannot be determined to be a local function, generate a stub code by the static linker during link time;

direct, during link time, the first function call to enter the stub code,

wherein the directing the first function call to enter the stub code includes replacing a symbol for the callee function in the first function call with an address of the stub code.

3. A computer system comprising:

a memory to store a static linker, a first module, and a second module; and

a processor, communicatively coupled to the memory, the computer system configured to:

identify, during link time, a first function call of a calling function to a callee function;

determine whether the callee function is a local function;

in response to determining that the callee function is a local function, determine whether the callee function has a plurality of entry points and whether an entry point of the plurality of entry points is a local entry point, the determining of whether the callee function has a plurality of entry points and whether an entry point of the plurality of entry points is a local entry point including accessing symbol information from a symbol table, the symbol table indicating a number of entry points and whether an entry point is a local entry point; and

resolve, during link time, the first function call to enter the local entry point when it is determined that the callee function has a plurality of entry points and an entry point of the plurality of entry points is the local entry point,

wherein the resolving of the first function call to enter the local entry point includes replacing a symbol for the callee function in the first function call with an address of the local entry point during link time.

4. The computer system of claim 3 , further comprising:

in response to determining that the callee function cannot be determined to be a local function, generating a stub code by the static linker during link time; and

directing, during link time, the first function call to enter the stub code,

wherein the directing the first function call to enter the stub code includes replacing a symbol for the callee function in the first function call with an address of the stub code.

5. The computer system of claim 4 , further comprising:

inserting a table of contents (“TOC”) save command for a TOC pointer value in one of the stub code or a TOC save placeholder instruction of the calling function; and

inserting a TOC restore command in a TOC restore placeholder instruction after the first function call in the calling function.

6. The computer system of claim 3 , further comprising:

in response to determining that the callee function cannot be determined to be a local function,

determining that the callee function does not require a table of contents (“TOC”) pointer value; and

resolving, during link time, the first function call to enter the callee function.

7. The computer system of claim 6 , wherein the callee function is a recursive function.

8. The computer system of claim 3 , further comprising:

inserting an alternate call sequence when the callee function does not have a plurality of entry points.

9. The computer system of claim 3 , wherein the resolving of the first function call to enter the local entry point includes:

retrieving symbol information from a symbol table, the symbol table having symbol information that includes an address of a global entry point and an offset from the global entry point to the local entry point; and

adding the offset to the global entry point to obtain the address of the local entry point.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 28, 2014
From: GSCHWIND, MICHAEL KARL; WEIGAND, ULRICH
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 034051/0289 →
Continuity (1)
Related Publication 20160117201A1 · Apr 28, 2016