Project Stage 2: Introduction

Building a Custom GCC Pass for Function Clone Analysis

I'm thrilled to provide my strategies for working on Project Stage 2, which is about developing a customized GCC compiler pass. Due to the complexity of this endeavour, I will be writing many posts to chronicle my progress.

Project Overview
We're creating a unique GCC pass for Stage 2 that will:

  • Determine which functions were copied during compilation.
  • Examine these replicated routines to find any duplication.
  • Output messages showing which clones need to be pruned in the GCC dump
Why This Matters
This work is groundbreaking in the field of automated function multi-versioning (AFMV). By explicitly identifying and removing superfluous function clones, our approach will be the first to increase code efficiency and decrease binary size.

Technical Approach
Analyzing function clones while disregarding surface-level variations like variable names is the main problem. We must create a technique for creating signatures that ignores implementation specifics that have no bearing on functionality and instead captures the fundamental structure and behaviour of functions.

Implementation Plan
I'll be approaching this project in phases:
  1. Setting up the foundation: Creating a boilerplate GCC pass and integrating it into the compiler source tree
  2. Identifying cloned functions: Detecting functions that follow the "function.variant" naming pattern and locating their resolver functions
  3. Comparison methodology: Developing a system to generate comparable signatures for functions or directly comparing their structure
  4. Cross-architecture testing: Ensuring our pass works correctly on both AArch64 and x86 architectures

Initially, we'll simplify our approach by assuming each program contains only one cloned function with two versions.

Attribution
The project requirements come from Professor Chris Tyler. For more details, check out his wiki at spo600.cdot.systems.
 http://spo600.cdot.systems/doku.php?id=spo600:2025_winter_project#project_stage_2clone-pruning_analysis_pass

Comments

Popular posts from this blog

Project Stage 3: Enhancing GCC Pass for Multiple Function Clone Handling: Progress Update

Project Stage 1: Troubleshooting a bit - Coming soon

Lab - 1: Exploring 6502 Assembly