Linker Rewriting Eliminates TOC Pointer References

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing linker rewriting techniques continue to require the use of the Table of Contents (TOC) pointer register, which can lead to inefficient code and increased processor resource consumption due to pipeline hazards and unnecessary modifications, especially in scenarios where the executable does not fit within certain address spaces or lacks specific processor instructions.

Innovation Solution

A method where the compiler generates object files with annotations that inform the linker to eliminate eliminable references to the TOC pointer register, allowing the linker to rewrite code sequences and eliminate prologue instructions, thereby avoiding the use of the TOC pointer register altogether.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If the TOC pointer register is used in existing linker rewriting techniques, then the code can be generated to access global variables and functions, but the processor resource consumption increases and pipeline hazards occur

Engineering Contradiction:
Improvecode correctnessVSAvoidprocessor resource consumption
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The patent extracts and eliminates the TOC pointer register references from the generated code by using annotations in the object file to guide the linker in rewriting code sequences. The linker identifies and removes prologue instructions that set up the TOC pointer and replaces TOC-based addressing with direct addressing modes, thereby extracting the harmful dependency on the TOC register while preserving code correctness.

Inventive Principle:
Principle #2Taking out (Extraction)

2Reliability

If the TOC pointer register is used in existing linker rewriting techniques, then the code can be generated to access global variables and functions, but pipeline hazards are introduced

Engineering Contradiction:
Improvecode correctnessVSAvoidprocessor execution speed
Core Design Contradiction:
ReliabilityVSSpeed

Solution Approach 1:

The patent removes pipeline hazards by extracting and eliminating the TOC pointer register setup instructions from the code. The linker uses annotations to identify prologue instructions that create pipeline dependencies and replaces them with optimized code sequences that use direct addressing, thereby removing the source of pipeline hazards while maintaining correct program behavior.

Inventive Principle:
Principle #2Taking out (Extraction)

3Adaptability or versatility

If multiple object file variants are generated to accommodate different execution scenarios, then compatibility is improved, but the complexity of software development increases

Engineering Contradiction:
Improveexecution scenario compatibilityVSAvoidsoftware development complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent implements a universal solution by generating a single object file variant that uses annotations to convey information about eliminable TOC references. The linker processes these annotations to produce optimized code appropriate for the target execution scenario, eliminating the need to maintain multiple object file variants while achieving the same adaptability benefits.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The patent applies preliminary action by having the compiler generate annotations in the object file that pre-identify instructions with eliminable TOC references. This preliminary marking allows the linker to perform optimizations without needing to analyze all possible execution scenarios, thereby simplifying the development process while maintaining compatibility across different scenarios.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS10175966B2Linker rewriting to eliminate TOC pointer references
Publication Date: 2019.01.08 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US10175966B2 patent drawing
  • US10175966B2 patent drawing
  • US10175966B2 patent drawing

AI summary

A method and associated computer program product are disclosed for generating an object file for subsequent linking by a linker. The object file comprises a function that references a table of contents (TOC) pointer register. The method comprises generating, in the object file, at least one first annotation that identifies at least one instruction of the function. The at least one instruction has an eliminable reference to the TOC pointer register. The first annotation configures the linker to determine, during the subsequent linking of the object file and based on the at least one first annotation, whether to eliminate the eliminable reference.