Posts

Project Stage 2: Clone-Pruning Analysis Pass

Image
Revamping the GCC Pass for Function Clones In my first project, I created a tool (called a "GCC pass") that worked on two types of computer systems (x86-64 and AARCH64). This tool could print the names of functions (pieces of code that do specific tasks) and count how many "blocks" (sections of code) each function had. However, I wanted to improve it in my second project to do something more advanced — specifically, to detect when a function is a copy of another one (a "cloned" function). Here's how I went about improving this tool. Making Changes to the Tool The first thing I did was teach the tool how to detect a cloned function. When the tool detects one, it stops checking further because I only need to work with one cloned function at a time for now. I also decided to temporarily skip counting the statements and blocks of code, since I will come back to that later when comparing cloned functions. Writing the Updated Code I started by writing the up...

Lab05 - x86_64

Image
Objective:   In this lab, I worked with 64-bit assembly language on x86_64 platform to learn about CPU architecture and assembly instructions. Getting Started with Code Example   The first step is to retrieve the code example from the server. The file is compressed, so we'll extract it into the desired location (in my case, the home directory): cd ~ tar xvf /public/spo600-assembler-lab-examples.tgz Once extracted, you’ll see a folder named  spo600 , which contains all the necessary files. x86_64: Investigating the C Code To explore the C version of the program, navigate to the folder containing the  hello.c  file and compile it using  make : make x86_64:  Disassemble the binary to view the assembly code: objdump -d hello x86_64: This will show us the assembly instructions, where we can observe that different CPU architectures (x86_64 vs Aarch64) generate different instructions, even for the same program. Exploring the x86_64 Platform Now, let’s dive in...