15-213 Recitation 6 – 2/26/01 Outline Linking Exam Review –Topics Covered –Your Questions Shaheen Gandhi Office Hours: Wednesday.

Slides:



Advertisements
Similar presentations
Recitation 4 Outline Buffer overflow –Practical skills for Lab 3 Code optimization –Strength reduction –Common sub-expression –Loop unrolling Reminders.
Advertisements

Recitation 4: 09/30/02 Outline The Stack! Essential skill for Lab 3 –Out-of-bound array access –Put your code on the stack Annie Luo
Recitation 8 – 3/25/02 Outline Dynamic Linking Review prior test questions 213 Course Staff Office Hours: See Posting.
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. 09: Compiling-Assembling-Linking Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer.
CS 4284 Systems Capstone Godmar Back Linking and Loading.
Binghamton University CS-220 Spring 2015 Binghamton University CS-220 Spring 2015 Object Code.
1 Homework / Exam Turn in mp2 at start of class today Reading –PAL, pp 3-6, Exam #1 next class –Open Book / Open Notes –NO calculators or other.
University of Washington Instruction Set Architectures ISAs Brief history of processors and architectures C, assembly, machine code Assembly basics: registers,
Instruction Set Architectures
Memory Image of Running Programs Executable file on disk, running program in memory, activation record, C-style and Pascal-style parameter passing.
UBC104 Embedded Systems Variables, Structures & Pointers.
Position Independent Code self sufficiency of combining program.
UBC104 Embedded Systems Functions & Pointers.
Microprocessors Frame Pointers and the use of the –fomit-frame-pointer switch Feb 25th, 2002.
Computer Architecture and Assembly Languages Course’s web site: Teaching Assistant: Or Peri Office Hours: Thursday 37/-108.
1 Assemblers and Linkers. 2 Goals for this Lecture Help you to learn about: The assembly process IA-32 machine language Why? Machine language is the last.
C Prog. To Object Code text text binary binary Code in files p1.c p2.c
Recitation 2: Assembly & gdb Andrew Faulring Section A 16 September 2002.
CS 3204 Operating Systems Godmar Back Lecture 11.
1 Carnegie Mellon Stacks : Introduction to Computer Systems Recitation 5: September 24, 2012 Joon-Sup Han Section F.
Practical Session 4. Labels Definition - advanced label: (pseudo) instruction operands ; comment valid characters in labels are: letters, numbers, _,
Lecture-1 Compilation process
Recitation 4: The Stack & Lab3 Andrew Faulring Section A 30 September 2002.
University of Washington Roadmap 1 car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Car c = new Car(); c.setMiles(100);
1 Carnegie Mellon Recitation : Introduction to Computer Systems Recitation 15: December 3, 2012 Daniel Sedra Section C.
Recitation 2 – 2/11/02 Outline Stacks & Procedures Homogenous Data –Arrays –Nested Arrays Mengzhi Wang Office Hours: Thursday.
Lec 4Systems Architecture1 Systems Architecture Lecture 4: Compilers, Assemblers, Linkers & Loaders Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan.
Linking Ⅱ.
ELF binary # readelf -a foo.out ELF Header:
University of Washington Basics of Machine Programming The Hardware/Software Interface CSE351 Winter 2013.
Programs and Processes Jeff Chase Duke University.
Bits and Bytes September 1, F’05 class02.ppt “The Class That Gives CMU Its Zip!”
Buffer Overflow Attack- proofing of Code Binaries Ramya Reguramalingam Gopal Gupta Gopal Gupta Department of Computer Science University of Texas at Dallas.
University of Amsterdam Computer Systems – the instruction set architecture Arnoud Visser 1 Computer Systems The instruction set architecture.
Carnegie Mellon 1 Midterm Review : Introduction to Computer Systems Recitation 8: Monday, Oct. 14, 2013 Marjorie Carlson Section A.
1 Linking. 2 Outline Symbol Resolution Relocation Suggested reading: 7.6~7.7.
CS429 Computer Architecture Topics Simple C program Basic structure, functions, separate files Compilation Phases, options Assembler GNU style, byte ordering,
1 Linking. 2 Outline What is linking and why linking Complier driver Static linking Symbols & Symbol Table Suggested reading: 7.1~7.5.
Recitation 3 Outline Recursive procedure Complex data structures –Arrays –Structs –Unions Function pointer Reminders Lab 2: Wed. 11:59PM Lab 3: start early.
Carnegie Mellon Midterm Review : Introduction to Computer Systems October 15, 2012 Instructor:
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin May 2-4, 2011 unstrip: Restoring Function Information to Stripped Binaries Using Dyninst Emily.
Linking I Topics Assembly and symbol resolution Static linking Systems I.
OUTLINE 2 Pre-requisite Bomb! Pre-requisite Bomb! 3.
Spring 2016Assembly Review Roadmap 1 car *c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Car c = new Car(); c.setMiles(100);
Introduction to Computer Systems Topics: Assembly Stack discipline Structs/alignment Caching CS 213 S ’12 rec8.pdf “The Class That Gives CMU Its.
Practical Session 3.
Recitation 3: Procedures and the Stack
Instruction Set Architecture
Static and dynamic analysis of binaries
Overview of today’s lecture
Computer Architecture and Assembly Language
Computer Architecture and Assembly Language
143A: Principles of Operating Systems Lecture 8: Basic Architecture of a Program Anton Burtsev October, 2017.
Homework In-line Assembly Code Machine Language
ICS143A: Principles of Operating Systems Lecture 21: Program linking and loading Anton Burtsev March, 2017.
CS 5204 Operating Systems Linking and Loading Godmar Back.
Recitation 2 – 2/4/01 Outline Machine Model
Emily Jacobson and Nathan Rosenblum
Machine-Level Programming 1 Introduction
Computer Architecture and Assembly Language
Y86 Processor State Program Registers
C Prog. To Object Code text text binary binary Code in files p1.c p2.c
CS 4284 Systems Capstone Linking and Loading Godmar Back.
Assembly Language Programming II: C Compiler Calling Sequences
Machine-Level Programming: Introduction
Recitation 5 – 2/19/01 Outline
Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan
Machine-Level Programming I: Basics Comp 21000: Introduction to Computer Organization & Systems Instructor: John Barr * Modified slides from the book.
Computer Architecture and System Programming Laboratory
Computer Architecture and System Programming Laboratory
Presentation transcript:

Recitation 6 – 2/26/01 Outline Linking Exam Review –Topics Covered –Your Questions Shaheen Gandhi Office Hours: Wednesday 1:30 – 2:30 Wean 3108 Reminders EXAM 1: Tomorrow DH 2210 Review Session Tonight, Wean :30 PM

Linking Process of patching binaries with correct addresses of symbols unknown at compile time Enables use of multiple source files and shared libraries

Linking: Example a.c #include int i = 0; int main(int argc, char *argv[]) { increment_i(); printf(“i: %d\n”, i); }

Linking: Example b.c extern int i; void increment_i() { i++; }

Linking: Example Compilation gcc –c –o a.o a.c gcc –c –o b.o b.c - Generate unlinked binary gcc –o prog a.c b.c - Generate executable objdump –D a.o b.o > ab.bdis - Disassemble unlinked binaries objdump –D prog > prog.bdis - Disassemble executable

Linking: Example ab.bdis : 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 08 sub $0x8,%esp 6: e8 fc ff ff ff call 7 b: 83 c4 f8 add $0xfffffff8,%esp e: a mov 0x0,%eax 13: 50 push %eax 14: push $0x0 19: e8 fc ff ff ff call 1a 1e: 83 c4 10 add $0x10,%esp 21: 89 ec mov %ebp,%esp 23: 5d pop %ebp 24: c3 ret Which bytes of the above will the linker have to change?

Linking: Example ab.bdis (cont’d) : 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: ff incl 0x0 9: 89 ec mov %ebp,%esp b: 5d pop %ebp c: c3 ret Which bytes of the above will the linker have to change?

Linking: Example prog.bdis e4 : 80483e4: 55 push %ebp 80483e5: 89 e5 mov %esp,%ebp 80483e7: 83 ec 08 sub $0x8,%esp 80483ea: e8 1d call c 80483ef: 83 c4 f8 add $0xfffffff8,%esp 80483f2: a1 8c mov 0x804948c,%eax 80483f7: 50 push %eax 80483f8: push $0x fd: e8 06 ff ff ff call : 83 c4 10 add $0x10,%esp : 89 ec mov %ebp,%esp : 5d pop %ebp : c3 ret

Linking: Example prog.bdis (cont’d) c : c: 55 push %ebp d: 89 e5 mov %esp,%ebp f: ff 05 8c incl 0x804948c : 89 ec mov %ebp,%esp : 5d pop %ebp : c3 ret

Exam Review: Topics Covered Bits and Bytes –Memory Organization –Endian-ness –Bit-wise Operations Integer Representation –Two’s Complement, Unsigned –Arithmetic Operations Machine Level Programming –Assembly (lots of it) –Stack Discipline –Jump Tables

Exam Review: Topics Covered Structured Data –Arrays –struct s and union s Floating Point Linking