2 both the movsbl and the movzbl instruction serve to

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: tted the suffix ‘l’ from many of the instructions. GAS. In Compared to the assembly code in code.s we also see an additional nop instruction at the end. This instruction will never be executed (it comes after the procedure return instruction), nor would it have any effect if it were (hence the name nop, short for “no operation” and commonly spoken as “no op”). The compiler inserted this instruction as a way to pad the space used to store the procedure. Generating the actual executable code requires running a linker on the set of object code files, one of which must contain a function main. Suppose in file main.c we had the function: 1 2 3 4 int main() { return sum(1, 3); } Then we could generate an executable program test as follows: unix> gcc -O2 -o prog code.o main.c The file prog has grown to 11,667 bytes, since it contains not just the code for our two procedures but also information used to start and terminate the program as well as to interact with the operating system. We can also disassemble the file prog: unix> objdump -d prog The disassembler will extract various code seque...
View Full Document

Ask a homework question - tutors are online