Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

C compilation process

5.517 Aufrufe

Veröffentlicht am

This ppt will demonstrate the compilation process stages in C language. C compilation process has 4 stages. They are pre-processor, compiler, assembler and linker. Each stage has its own functionality. The final outcome of these stages would be a C executable file. GCC tool is used in linux platform to compile C code. And It will generate *.out files as an executable.

Veröffentlicht in: Bildung, Technologie
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • Dating for everyone is here: ♥♥♥ http://bit.ly/369VOVb ♥♥♥
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • Sex in your area is here: ❤❤❤ http://bit.ly/369VOVb ❤❤❤
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • Thanks Kumar.
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • Nice information ...
    Good Work Raj Kumar..
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier

C compilation process

  1. 1. Compilation Process in C R RAJ KUMAR 2/4/2014 RAJ KUMAR RAMPELLI
  2. 2. Compilation process in C • Compilation process ? – Constructing an executable image for an application – FOUR stages – Command: gcc <options> <source_file.c> • Compiler Tool – gcc • man gcc (on Linux m/c) 2/4/2014 RAJ KUMAR RAMPELLI
  3. 3. 4 stages of compilation process Preprocessor gcc –E app.c –o app.i app.c  Hello.c Compiler gcc –S app.i –o app.s Assembler gcc –c app.s –o app.o Linker gcc app.o –o app Output  Executable (a.out) Run  ./app (Loader) 2/4/2014 RAJ KUMAR RAMPELLI
  4. 4. 4 stages of compilation process • Preprocessor – Expansion of Header files – Substitute macros and inline functions • Compiler – Generates assembly language – Verification of functions usage using prototypes – Header files: Prototypes declaration • Assembler – Generates re-locatable object file (contains m/c instructions) – nm app.o 0000000000000000 T main U puts – Nm or objDump tool used to view object files 2/4/2014 RAJ KUMAR RAMPELLI
  5. 5. 4 stages of compilation proces (contd..) • Linker – Generates executable file (nm tool used to view exe file) – Binds appropriate libraries • Static Linking • Dynamic Linking (default) Timing of linking At Load time At Run time • Loader – – – – 2/4/2014 Evaluate size of code and data segment Allocates address space in the user mode and transfers them into memory Load dependent libraries needed by program and links them Invokes Process Manager  Program registration RAJ KUMAR RAMPELLI
  6. 6. Compiling a C Program • gcc <options> program_name.c Options: -----------Wall: Shows all warnings -o output_file_name: By default a.out executable file is created when we compile our program with gcc. Instead, we can specify the output file name using "-o" option. -g: Include debugging information in the binary. 2/4/2014 RAJ KUMAR RAMPELLI
  7. 7. Linking Multiple files to make executable file • If we have two programs say prog1.c and prog2.c for one single task then we can make single executable file using following instructions First, compile these two files with option "-c" gcc -c prog1.c gcc -c prog2.c -c: Tells gcc to compile and assemble the code, but not link. We get two files as output, prog1.o and prog2.o Now, we can link these object files into single executable file using below instruction. gcc -o prog prog1.o prog2.o Now, the output is prog executable file. We can run our program using ./prog 2/4/2014 RAJ KUMAR RAMPELLI
  8. 8. Linking with other libraries • Normally, compiler will read/link libraries from /usr/lib directory to our program during compilation process. But, there are some case where we need to link our programs with libraries like pthreads and realtime libraries (rt library). Use below instruction for this purpose gcc <options> program_name.c -lpthread -lrt -lpthread: Link with pthread library -lrt: Link with rt library Option here is "-l<library>" Another option "-L <dir>" used to tell gcc compiler search for libraries in given <dir> directory. 2/4/2014 RAJ KUMAR RAMPELLI
  9. 9. Thank You 2/4/2014 RAJ KUMAR RAMPELLI

×