Posts

SPO600 Project Stage 2 (Pt.1) - GCC pass locating clone function

Image
In project stage 1, I created a GCC pass in both x86-64 server and AARCH64 server to print the functions' name and counting number of block. Now, I would like to revise the pass again and increase it's functionality. Step 1. Modify the pass First, I would like to detect if the function is a clone. When a clone is detected, loop will be broken. Meanwhile, just ignore the count of statement and blocks first. They will be useful for later part. revised code: /* Test Pass Jeff Yau, Seneca Polytechnic College Student ID :142466234 Modelled on tree-nrv.cc and tree-ctyler.cc by Chris Tyler, Seneca Polytechnic College, 2024-11 This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even th...

SPO600 Project Stage 1 (Pt.2) - Revise the GCC Pass

Image
In part 1 , I created a GCC pass in x86-64 server to print the functions' name. Now, I would like to revise the pass and increase it's functionality. Revised GCC pass code: /* Test Pass Jeff Yau, Seneca Polytechnic College Modelled on tree-nrv.cc and tree-ctyler.cc by Chris Tyler, Seneca Polytechnic College, 2024-11 This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ //#define INCLUDE_MEMORY #...

SPO600 Lab5 64-Bit Assembly Language Lab Pt.2 ---x86_64 part

Image
In the part 2 of this Lab , I am going to experiment with assembler on the x86_64 platforms, similar to the Lab part 1. Task 1 Observe the difference between source code and the object file of the x86 assembly language  Source code (gas / AT&T ): Source code (nasm / Intel): object file (gas):  Task 2 -- modify a loop code in the x86 system to print loop for 6 times. Before that, I want to modifty the Makefile so that it can make file for the loop-gas.s Revised Makefile: code: BINARIES=hello-nasm hello-gas loop-gas all: ${BINARIES} AS_ARGS=-g hello-nasm: hello-nasm.s nasm -g -o hello-nasm.o -f elf64 hello-nasm.s ld -o hello-nasm hello-nasm.o hello-gas: hello-gas.s as ${AS_ARGS} -o hello-gas.o hello-gas.s ld -o hello-gas hello-gas.o loop-gas: loop-gas.s as ${AS_ARGS} -...

SPO600 Project Stage 1 (Pt.1) - Create a GCC Pass

Image
Create a GCC Pass I would like to create a GCC Pass. I expect the pass will be used to analyze the GIMPLE files. Step 1. Get to the gcc subdirectory I go to the directory of my gcc source code. Then, I get to the gcc subdirectory inside the sourcecode of gcc. Step 2. Create a very simple pass I create a Pass file modeled on the pass_nrv. I just hope the pass works first. So, the pass is as simple as possible. code: /* Test Pass Jeff Yau, Seneca Polytechnic College Modelled on tree-nrv.cc and tree-ctyler.cc by Chris Tyler, Seneca Polytechnic College, 2024-11 This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se...

SPO600 Lab5 64-Bit Assembly Language Lab Pt.1 ---AArch64 part

Image
In this Lab, I am going to experiment with assembler on the x86_64 and aarch64 platforms. Task 1 Observe the difference between source code and the object file of the aarch64 assembly language  source file: object file: Task 2 -- A loop which print 6 "Loop" word  I have to modify a provided code block in the aarch64 system to print loop for 6 times.  modified code: .text .globl _start min = 0                          /* starting value for the loop index; **note that this is a symbol (constant)**, not a variable */ max = 6                         /* loop exits when the index hits this number (loop condition is i<max) */ _start:      mov     x19, min loop:      /* ... body of the loop ... do something useful here ... */      mov     x0, 1           /* file des...

SPO600 Lab4 -GCC Build Lab

Image
 In this lab, we are practicing about building large software project, utilizing tools such as make and automake/autotools. I will work on two server, x86-001 and aarch64-002 Task  - on each of the servers, obtain build and install the source code for the current development version of the GCC compiler. Step 1 - Obtain the source code  step 1.1 the command to create a directory for cloning the GCC source code: mkdir gccsource  step 1.2 command to clone the source code into the current directory: git clone git://gcc.gnu.org/git/gcc.git ./gccsource Step 2 - Configure the build step 2.1 Create a directory for the build of GCC and go into it. We use this directory to build the ggc so that the files created during the build go into this directory. Commands: mkdir gcc-build-003 cd gcc-build-003 step 2.2 When I configure the build,  I do not want the new GCC wipe out the original gcc in the server. So, I use the --prefix=$HOME/spo600/lab4/gcc-test-003 to set the target...