Today’s Topic Breakdown of CC script.

Slides:



Advertisements
Similar presentations
Copyright 2013 – Noah Mendelsohn Compiling C Programs Noah Mendelsohn Tufts University Web:
Advertisements

Today ’ s Topic Breakdown of GCC script Breakdown of GCC script Description of how different system programs work together to build (and run) a C program.
CS 31003: Compilers ANIRUDDHA GUPTA 11CS10004 G2 CLASS DATE : 24/07/2013.
UEE072HM Embedded Control Systems. Breaking down the compilation process Compilation is made up of a number of phases –Preprocessing –Compilation Can.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
Enabling the ARM Learning in INDIA ARM DEVELOPMENT TOOL SETUP.
Intro to Computer Systems Summer 2014 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University.
Computer Engineering 1 nd Semester Dr. Rabie A. Ramadan 2.
Creating your first C++ program
Programming With C.
Program Compilation and Execution. Today’s Objectives Explain why runtime stack needed for C Explain why runtime stack needed for C Draw logical division.
1 Programming in C Hello World! Soon I will control the world! Soon I will control the world!
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
N from what language did C++ originate? n what’s input, output device? n what’s main memory, memory location, memory address? n what’s a program, data?
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
RNJ 05/05/091 6 Further System Fundamentals (HL) ‏ 6.3 Operating Systems and Utility Software Linkers, Loaders and Library Managers.
Typical C++ Environment and Library Introduction Speaker : Wei-Lu Lin Advisor : Ku-Yaw Chang 2012/10/14.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Compilers I CNS History Wires Wires Machine Language Machine Language FFBA FFBA No Translation necessary No Translation necessary Assembly Language.
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
Introduction to OOP CPS235: Introduction.
First Compilation Rudra Dutta CSC Spring 2007, Section 001.
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
COP4020 Programming Languages Introduction Prof. Robert van Engelen (modified by Prof. Em. Chris Lacher)
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Hello world !!! ASCII representation of hello.c.
Operating Systems A Biswas, Dept. of Information Technology.
برمجه حاسبات 2 أ. بيان غزلان الفصل الدراسي هـ.
1 THE C COMPILATION STEPS. Najib Nadi Computing Sciences VU C Compilation Steps C Source Code FILE prog.c OPTION C Source Code C Source Code C Source.
1 CS 192 Lecture 4 Winter 2003 December 8-9, 2003 Dr. Shafay Shamail.
Lecture 3 Translation.
Introduction to C Topics Compilation Using the gcc Compiler
Chapter 1 Introduction 2nd Semester H
Topic 2: Hardware and Software
UMBC CMSC 104 – Section 01, Fall 2016
Visit for more Learning Resources
Computer Systems MTSU CSCI 3240 Spring 2016 Dr. Hyrum D. Carroll
Chapter 5- Assembling , Linking, and Executing Programs
Language Translation Compilation vs. interpretation.
Chapter 1: A Tour of Computer Systems
CISC105 – General Computer Science
The compilation process
ENERGY 211 / CME 211 Lecture 25 November 17, 2008.
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Computer Engineering 1nd Semester
Introduction to C Topics Compilation Using the gcc Compiler
Software Development with uMPS
Introduction to C Topics Compilation Using the gcc Compiler
and Executing Programs
Activation Records and Function Calls
Computer Organization & Compilation Process
COP4020 Programming Languages
Creating your first C program
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Appendix F C Programming Environment on UNIX Systems
Chapter 11 Programming in C
Program Compilation and Execution
PROGRAM AT RUNTIME Subject code: CSCI-620
Computer Organization & Compilation Process
Chapter 1 Introduction to Programming
Introduction to C Topics Compilation Using the gcc Compiler
System Programming By Prof.Naveed Zishan.
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
SPL – PS1 Introduction to C++.
Topic 2b ISA Support for High-Level Languages
Presentation transcript:

Today’s Topic Breakdown of CC script

Today’s Objectives Within context of “compiling” C program Define actions of linker, compiler, assembler, OS, macro preprocessor, loader Draw block diagram showing order of linker, compiler, assembler, OS, macro preprocessor, loader Explain why runtime stack needed for C Draw logical division of memory into stack, heap Compare and contrast stack and heap For C program, indicate which variables are stored in heap; in stack; in neither

Breaking Down CC Preprocessed Source source Compiler Assembler .s ASM Compiler Assembler Preprocessor .s O B J E C T Executable Program In Memory Executable Loader Linker a.out .o

Breaking Down CC Preprocessed Source source Compiler Assembler .s ASM Compiler Assembler Preprocessor .s O B J E C T Executable Program In Memory Executable Loader Linker a.out .o

C Preprocessor (cpp) Pass over source Define macros Insert included files Perform macro substitutions Define macros #define NUM 100 #define xx(v,name,op,metrics) \ v=xxinit(op,name,IR->metrics) gcc –E example.c sends preprocessor output to stdout

Breaking Down CC Preprocessed Source source Compiler Assembler .s ASM Compiler Assembler Preprocessor .s O B J E C T Executable Program In Memory Executable Loader Linker a.out .o

Compiler gcc actually name of a script Compiler translates one language to another (or the same???) gcc compiler translates C to assembler gcc –S example.c “saves” example.s Compiler consists of Parser Code generation Mysticism

Breaking Down CC Preprocessed Source source Compiler Assembler .s ASM Compiler Assembler Preprocessor .s O B J E C T Executable Program In Memory Executable Loader Linker a.out .o

Assembler Another translator ??? (as example.s) Assembler to (binary) object Why not compile straight to binary? gcc –c example.c to “save” object NM to look at object (nm example.o)

Breaking Down CC Preprocessed Source source Compiler Assembler .s ASM Compiler Assembler Preprocessor .s O B J E C T Executable Program In Memory Executable Loader Linker a.out .o

Linker Combine objects, both user .o files and libraries, make an executable gcc *.o –lm yields a.out gcc –o myExec *.o –lm Use nm to look at object

Breaking Down CC Preprocessed Source source Compiler Assembler .s ASM Compiler Assembler Preprocessor .s O B J E C T Executable Program In Memory Executable Loader Linker a.out .o

Loader Gets an address to place program Changes necessary addresses (if any) Places code into memory

Operating System Oversees whole process “Recognizes” gcc example.c command Parses flags and arguments Invokes gcc script Performs memory mangagement (malloc) Chooses “address” to place program