Sunday, October 28, 2018

Lab 4

The goal of this lab was to  see first hand the differences between  aarch64 and x86_64 assembly code

in the example we had
Both started at the top with
.text
.global _

defining values were the same as well
with things like the following
start = 0
max = 0 

How ever function calls are different (mostly)

_Start:  << was a common factor

how ever
loop: << x86
_loop: <<aarch

one needed the _ where the other didn't

In the x86 we have more
 things like movq << the q specifically instead of mov(aarch)
it uses %num , %othernum
where as in aarch it use more simple with just and x before for registers
aarch has a cleaner looking code style with less special symbols needed for the values and items being passed or moved.

Lab 3

In our lab 3 we used different compiler options to see how it actually affected the code we gave to the compiler.

I worked in class with the group at the table on other members computers so we had a group effort to try different things and talk about what happened.

First we tried

gcc -g -O0 -fno-builtin -o initial source.c

as  our base line compile. This gave us a pretty small file and was rather fast and the made a small amount of assembler code.

The second test was with the -static option

gcc -g -O0 -fno-builtin -static -o static source.c

This yielded a very large file in comparison to the original file it gave us. This made a static call to the function rather than a dynamic, which made the function calls faster but the program large because it had to make the static library for it.

Third we got rid of the  -fno so we has just nobuiltin

gcc -g -O0 -o nobuiltin source.c

This gave us a similar sized file to the first one but the it was supposed to speed up the printline calls in the program, switching them to another type of call making it  slightly more efficient.

Forth we tried with nog 

gcc -O0 -fno-builtin -o nog source.c

We got a slightly larger file it seemed but it gave us debug info in the code so it was easier to read.