From Website:

Size: px
Start display at page:

Download "From Website:"

Transcription

1 From Website: Hello World: C, Assembly, Object File and Executable By Dejan Lukan January 7th, 2013 Introduction Summary: In this article we ll take a look at the C program that prints Hello World! to the screen, which we ll assemble and compile. Then we ll compare the results and try to present what s happening beneath the curtains. Specifically, we will look at which sections are present in the transformation chain: from C code, to assembly code, to object file, to executable. Hello World Program: The Assembly First we need to write the hello world C program, which can be seen below: #include <stdio.h> int main() { printf("hello World!"); return 0; } It s a very simple program that doesn t actually do anything; we intentionally kept it this simple, so we will be able to focus on the bigger picture and not tons of code. We then need to compile the program to obtain the assembly code we don t want to do anything else right now. To do that we can use the -S option passed to the gcc program, which takes the source code of the program and generates the assembly instructions. We also want the masm Intel assembly source code and not some other format. We can achieve that by passing the -masm=intel to the gcc program. If we re on the 64- bit operating system, we also want to compile the program as 32-bit, which we can achieve by passing the -m32 argument to the gcc program. The whole gcc command that we re using can be seen in the output below: # gcc -m32 -masm=intel -S hello.c -o hello.s This command effectively takes the hello.c program and compiles it as 32-bit program into assembly instructions that are saved into the hello.s file. The hello.s file now looks like presented below:.file "hello.c".intel_syntax noprefix.section.rodata.lc0:.string "Hello World!".text.globl main.type main: push ebp

2 mov ebp, esp and esp, -16 sub esp, 16 mov eax, OFFSET FLAT:.LC0 mov DWORD PTR [esp], eax call printf mov eax, 0 leave ret.size main,.-main.ident "GCC: (Gentoo p1.0, pie-0.4.7) 4.5.4".section.note.GNU-stack,"",@progbits The.file directive states the original source file name that is normally used by debuggers. The.intel_syntax line specifies that we re using intel sytax assembly and not AT&T syntax. Afterwards we re defining the.rodata section, which is used for read-only data variables. In our case the.rodata section contains only the zero terminated string Hello World! that can be accessed with the LC0 variable. Then we re defining the.text section, which is used for the code of the program. First we must define the main function (notice the.type main,@function instruction), which is globally visible (notice the.globl main instruction). From the main: label till the ret instruction is the actual code of the program. That code first initializes the stack by pushing the value of the register EBP to the stack, moving the value of register ESP to EBP. The and esp,-16 is used for optimization because some operations can be performed faster if the stack pointer address is in a multiple of 16 bytes. That instruction is put in there because by default, gcc uses the optimization flag -O2. Then we re subtracting 16 bytes from the current ESP stack pointer register for local variables. Next, the address to the LC0 (our Hello World! string) is read into the register eax and moved to the top of the stack, which is the first and only parameter to the printf function that is called right after. The printf function prints that string on the screen and returns to the caller, which takes care of the stack and returns. The.size instruction sets the size of the main function. The.-main holds the exact size of the function main, which is written to the object file. The.ident instruction saves the GCC: (Gentoo p1.0, pie-0.4.7) string to the object file in order to save the information about the compiler which was used to compile the executable. Hello World Program: The Object File We ve seen the assembly code that was generated by the gcc directly from the corresponding C source code. But without the actual assembler and linker we can t run the executable. To assemble the executable into the object file, we must use the -c option with the gcc compiler, which only assembles/compiles the source file, but does not actually link it. To obtain the object file from the assembly code we need to run the command below: # gcc -m32 -masm=intel -c hello.s -o hello.o # file hello.o hello.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped We can see that the hello.o is the object file that is actually an ELF 32-bit executable, which is not linked yet. If we want to run the executable, it will fail as noted below: # chmod +x hello.o #./hello.o bash:./hello.o: cannot execute binary file We can read the contents of the object file with the readelf program as follows:

3 # readelf -a hello.o ELF Header: Magic: 7f 45 4c Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: REL (Relocatable file) Machine: Intel Version: 0x1 Entry point address: Start of program headers: 0 (bytes into file) Start of section headers: 224 (bytes into file) Flags: Size of this header: 52 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 40 (bytes) Number of section headers: 11 Section header string table index: 8 Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL [ 1].text PROGBITS d 00 AX [ 2].rel.text REL [ 3].data PROGBITS WA [ 4].bss NOBITS WA [ 5].rodata PROGBITS d 00 A [ 6].comment PROGBITS b 01 MS [ 7].note.GNU-stack PROGBITS c [ 8].shstrtab STRTAB c [ 9].symtab SYMTAB a [10].strtab STRTAB Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) There are no section groups in this file. There are no program headers in this file. Relocation section '.rel.text' at offset 0x350 contains 2 entries: Offset Info Type Sym.Value Sym. Name a R_386_ rodata R_386_PC printf There are no unwind sections in this file. Symbol table '.symtab' contains 10 entries: Num: Value Size Type Bind Vis Ndx Name 0: NOTYPE LOCAL DEFAULT UND

4 1: FILE LOCAL DEFAULT ABS hello.c 2: SECTION LOCAL DEFAULT 1 3: SECTION LOCAL DEFAULT 3 4: SECTION LOCAL DEFAULT 4 5: SECTION LOCAL DEFAULT 5 6: SECTION LOCAL DEFAULT 7 7: SECTION LOCAL DEFAULT 6 8: FUNC GLOBAL DEFAULT 1 main 9: NOTYPE GLOBAL DEFAULT UND printf No version information found in this file. We can see that the file is an ELF object file that has 11 section headers. The first section header is null. The second section header is.text, which contains the executable instructions of the program. The.rel.text holds the relocation information of the.text section. The relocation entries must be present, as our program instructions call external functions, whose function pointers must be updated upon the program execution. In the output above, we can see that the.rel.text holds two relocation entries: the.rodata and printf. The.data section holds the initialized data, while the.bss section holds uninitialized data that the program uses. The.rodata holds read-only data that can be used by the program; this is where our Hello World! string is stored. The.comment section holds version control information and the.note.gnu-stack holds some additional data that I won t describe here. The.shstrtab holds section names, while the.strtab holds section strings and the.symtab holds the symbol table. We can quickly figure out that in the assembly code there was only the.rodata and.text sections defined, but when we translated the assembly code into the object file, quite some sections were added to the file. Those sections are needed to successfully link the executable and properly execute the program. Hello World Program: The Executable The last step is to actually link the object file to make an executable. To do that, we must execute the command below: # gcc -m32 hello.o -o hello #./hello Hello World! We ve linked the object file hello.o into the executable./hello and executed it. Upon execution of the program, the program outputted the Hello World! string as it should. If we take a look at the ELF again, we can see that there is a lot of other information and file sections added to the executable, which can be seen below: $ readelf -a hello ELF Header: Magic: 7f 45 4c Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Intel Version: 0x1 Entry point address: 0x

5 Start of program headers: 52 (bytes into file) Start of section headers: 4392 (bytes into file) Flags: Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 10 Size of section headers: 40 (bytes) Number of section headers: 30 Section header string table index: 27 Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL [ 1].interp PROGBITS A [ 2].note.ABI-tag NOTE A [ 3].hash HASH a8 0001a A [ 4].gnu.hash GNU_HASH d0 0001d A [ 5].dynsym DYNSYM f0 0001f A [ 6].dynstr STRTAB c 00 A [ 7].gnu.version VERSYM c 00028c 00000a 02 A [ 8].gnu.version_r VERNEED A [ 9].rel.dyn REL b8 0002b A [10].rel.plt REL c0 0002c A [11].init PROGBITS d8 0002d AX [12].plt PROGBITS f0 0002f AX [13].text PROGBITS c 00 AX [14].fini PROGBITS cc 0004cc 00001c 00 AX [15].rodata PROGBITS e8 0004e A [16].eh_frame_hdr PROGBITS A [17].eh_frame PROGBITS A [18].ctors PROGBITS 08049f0c 000f0c WA [19].dtors PROGBITS 08049f14 000f WA [20].jcr PROGBITS 08049f1c 000f1c WA [21].dynamic DYNAMIC 08049f20 000f d0 08 WA [22].got PROGBITS 08049ff0 000ff WA [23].got.plt PROGBITS 08049ff4 000ff WA [24].data PROGBITS 0804a00c 00100c WA [25].bss NOBITS 0804a WA [26].comment PROGBITS a 01 MS [27].shstrtab STRTAB e 0000e [28].symtab SYMTAB d [29].strtab STRTAB d Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) There are no section groups in this file.

6 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR R E 0x4 INTERP R 0x1 [Requesting program interpreter: /lib/ld-linux.so.2] LOAD R E 0x1000 LOAD 00f0c 8049f0c 8049f0c RW 0x1000 DYNAMIC 00f f f20 00d0 00d0 RW 0x4 NOTE R 0x4 GNU_EH_FRAME R 0x4 GNU_STACK RW 0x4 GNU_RELRO 00f0c 8049f0c 8049f0c 00f4 00f4 R 0x1 PAX_FLAGS x4 Section to Segment mapping: Segment Sections interp 02.interp.note.ABI-tag.hash.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rel.dyn.rel.plt.init.plt.text.fini.rodata.eh_frame_hdr.eh_frame 03.ctors.dtors.jcr.dynamic.got.got.plt.data.bss 04.dynamic 05.note.ABI-tag 06.eh_frame_hdr ctors.dtors.jcr.dynamic.got 09 Dynamic section at offset 0xf20 contains 21 entries: Tag Type Name/Value (NEEDED) Shared library: [libc.so.6] c (INIT) 0x80482d d (FINI) 0x80484cc (HASH) 0x80481a8 0x6ffffef5 (GNU_HASH) 0x80481d (STRTAB) 0x (SYMTAB) 0x80481f a (STRSZ) 76 (bytes) b (SYMENT) 16 (bytes) (DEBUG) (PLTGOT) 0x8049ff (PLTRELSZ) 24 (bytes) (PLTREL) REL (JMPREL) 0x80482c (REL) 0x80482b (RELSZ) 8 (bytes) (RELENT) 8 (bytes)

7 0x6ffffffe (VERNEED) 0x x6fffffff (VERNEEDNUM) 1 0x6ffffff0 (VERSYM) 0x804828c (NULL) Relocation section '.rel.dyn' at offset 0x2b8 contains 1 entries: Offset Info Type Sym.Value Sym. Name 08049ff R_386_GLOB_DAT gmon_start Relocation section '.rel.plt' at offset 0x2c0 contains 3 entries: Offset Info Type Sym.Value Sym. Name 0804a R_386_JUMP_SLOT printf 0804a R_386_JUMP_SLOT gmon_start 0804a R_386_JUMP_SLOT libc_start_main There are no unwind sections in this file. Symbol table '.dynsym' contains 5 entries: Num: Value Size Type Bind Vis Ndx Name 0: NOTYPE LOCAL DEFAULT UND 1: FUNC GLOBAL DEFAULT UND printf@glibc_2.0 (2) 2: NOTYPE WEAK DEFAULT UND gmon_start 3: FUNC GLOBAL DEFAULT UND libc_start_main@glibc_2.0 (2) 4: ec 4 OBJECT GLOBAL DEFAULT 15 _IO_stdin_used Symbol table '.symtab' contains 52 entries: Num: Value Size Type Bind Vis Ndx Name 0: NOTYPE LOCAL DEFAULT UND 1: SECTION LOCAL DEFAULT 1 2: SECTION LOCAL DEFAULT 2 3: a8 0 SECTION LOCAL DEFAULT 3 4: d0 0 SECTION LOCAL DEFAULT 4 5: f0 0 SECTION LOCAL DEFAULT 5 6: SECTION LOCAL DEFAULT 6 7: c 0 SECTION LOCAL DEFAULT 7 8: SECTION LOCAL DEFAULT 8 9: b8 0 SECTION LOCAL DEFAULT 9 10: c0 0 SECTION LOCAL DEFAULT 10 11: d8 0 SECTION LOCAL DEFAULT 11 12: f0 0 SECTION LOCAL DEFAULT 12 13: SECTION LOCAL DEFAULT 13 14: cc 0 SECTION LOCAL DEFAULT 14 15: e8 0 SECTION LOCAL DEFAULT 15 16: SECTION LOCAL DEFAULT 16 17: SECTION LOCAL DEFAULT 17 18: 08049f0c 0 SECTION LOCAL DEFAULT 18 19: 08049f14 0 SECTION LOCAL DEFAULT 19 20: 08049f1c 0 SECTION LOCAL DEFAULT 20

8 21: 08049f20 0 SECTION LOCAL DEFAULT 21 22: 08049ff0 0 SECTION LOCAL DEFAULT 22 23: 08049ff4 0 SECTION LOCAL DEFAULT 23 24: 0804a00c 0 SECTION LOCAL DEFAULT 24 25: 0804a014 0 SECTION LOCAL DEFAULT 25 26: SECTION LOCAL DEFAULT 26 27: FILE LOCAL DEFAULT ABS hello.c 28: 08049f0c 0 NOTYPE LOCAL DEFAULT 18 init_array_end 29: 08049f20 0 OBJECT LOCAL DEFAULT 21 _DYNAMIC 30: 08049f0c 0 NOTYPE LOCAL DEFAULT 18 init_array_start 31: 08049ff4 0 OBJECT LOCAL DEFAULT 23 _GLOBAL_OFFSET_TABLE_ 32: FUNC GLOBAL DEFAULT 13 libc_csu_fini 33: FUNC GLOBAL HIDDEN 13 i686.get_pc_thunk.bx 34: 0804a00c 0 NOTYPE WEAK DEFAULT 24 data_start 35: FUNC GLOBAL DEFAULT UND printf@@glibc_2.0 36: 0804a014 0 NOTYPE GLOBAL DEFAULT ABS _edata 37: cc 0 FUNC GLOBAL DEFAULT 14 _fini 38: 08049f18 0 OBJECT GLOBAL HIDDEN 19 DTOR_END 39: 0804a00c 0 NOTYPE GLOBAL DEFAULT 24 data_start 40: NOTYPE WEAK DEFAULT UND gmon_start 41: 0804a010 0 OBJECT GLOBAL HIDDEN 24 dso_handle 42: ec 4 OBJECT GLOBAL DEFAULT 15 _IO_stdin_used 43: FUNC GLOBAL DEFAULT UND libc_start_main@@glibc_ 44: FUNC GLOBAL DEFAULT 13 libc_csu_init 45: 0804a01c 0 NOTYPE GLOBAL DEFAULT ABS _end 46: FUNC GLOBAL DEFAULT 13 _start 47: e8 4 OBJECT GLOBAL DEFAULT 15 _fp_hw 48: 0804a014 0 NOTYPE GLOBAL DEFAULT ABS bss_start 49: FUNC GLOBAL DEFAULT 13 main 50: NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses 51: d8 0 FUNC GLOBAL DEFAULT 11 _init Histogram for bucket list length (total of 3 buckets): Length Number % of total Coverage 0 0 ( 0.0%) 1 2 ( 66.7%) 50.0% 2 1 ( 33.3%) 100.0% Histogram for `.gnu.hash' bucket list length (total of 2 buckets): Length Number % of total Coverage 0 1 ( 50.0%) 1 1 ( 50.0%) 100.0% Version symbols section '.gnu.version' contains 5 entries: Addr: c Offset: 0028c Link: 5 (.dynsym) 000: 0 (*local*) 2 (GLIBC_2.0) 0 (*local*) 2 (GLIBC_2.0) 004: 1 (*global*)

9 Version needs section '.gnu.version_r' contains 1 entries: Addr: Offset: Link: 6 (.dynstr) : Version: 1 File: libc.so.6 Cnt: 1 010: Name: GLIBC_2.0 Flags: none Version: 2 Notes at offset with length : Owner Data size Description GNU NT_GNU_ABI_TAG (ABI version tag) OS: Linux, ABI: Conclusion We ve now seen how a simple program written in C is converted into the assembly code, the object file and finally the executable file. While in the C code, the program didn t have any sections, it had two sections in assembly dialect: the.rodata and.text. When we compiled it into an object file and finally into the executable, the file had more and more sections that are needed for the program to be executed successfully.

Link 8. Dynamic Linking

Link 8. Dynamic Linking Link 8. Dynamic Linking Young W. Lim 2018-12-27 Thr Young W. Lim Link 8. Dynamic Linking 2018-12-27 Thr 1 / 66 Outline 1 Linking - 8. Dynamic Linking Based on Dynamic linking with a shared library example

More information

Study and Analysis of ELF Vulnerabilities in Linux

Study and Analysis of ELF Vulnerabilities in Linux Study and Analysis of ELF Vulnerabilities in Linux Biswajit Sarma Assistant professor, Department of Computer Science and Engineering, Jorhat Engineering College, Srishti Dasgupta Final year student, Department

More information

Linux on zseries ABI and Linkage Format SHARE 102 Session 9236

Linux on zseries ABI and Linkage Format SHARE 102 Session 9236 Linux on zseries ABI and Linkage Format SHARE 102 Session 9236 Dr. Ulrich Weigand Linux on zseries Development, IBM Lab Böblingen Ulrich.Weigand@de.ibm.com Agenda Compiling, linking, and loading Function

More information

Link 3. Symbols. Young W. Lim Mon. Young W. Lim Link 3. Symbols Mon 1 / 42

Link 3. Symbols. Young W. Lim Mon. Young W. Lim Link 3. Symbols Mon 1 / 42 Link 3. Symbols Young W. Lim 2017-09-11 Mon Young W. Lim Link 3. Symbols 2017-09-11 Mon 1 / 42 Outline 1 Linking - 3. Symbols Based on Symbols Symbol Tables Symbol Table Examples main.o s symbol table

More information

Link 4. Relocation. Young W. Lim Sat. Young W. Lim Link 4. Relocation Sat 1 / 33

Link 4. Relocation. Young W. Lim Sat. Young W. Lim Link 4. Relocation Sat 1 / 33 Link 4. Relocation Young W. Lim 2017-09-16 Sat Young W. Lim Link 4. Relocation 2017-09-16 Sat 1 / 33 Outline 1 Linking - 4. Relocation Based on Relocation Relocation Entries Relocating Symbol Reference

More information

Split debug symbols for pkgsrc builds

Split debug symbols for pkgsrc builds Split debug symbols for pkgsrc builds Short report after Google Summer of Code 2016 Leonardo Taccari leot@netbsd.org EuroBSDcon 2016 NetBSD Summit 1 / 23 What will we see in this presentation? ELF, DWARF

More information

Link 4. Relocation. Young W. Lim Tue. Young W. Lim Link 4. Relocation Tue 1 / 38

Link 4. Relocation. Young W. Lim Tue. Young W. Lim Link 4. Relocation Tue 1 / 38 Link 4. Relocation Young W. Lim 2017-09-26 Tue Young W. Lim Link 4. Relocation 2017-09-26 Tue 1 / 38 Outline 1 Linking - 4. Relocation Based on Relocation Relocation Entries Relocation Algorithm Reloation

More information

Link 4. Relocation. Young W. Lim Mon. Young W. Lim Link 4. Relocation Mon 1 / 35

Link 4. Relocation. Young W. Lim Mon. Young W. Lim Link 4. Relocation Mon 1 / 35 Link 4. Relocation Young W. Lim 2017-09-25 Mon Young W. Lim Link 4. Relocation 2017-09-25 Mon 1 / 35 Outline 1 Linking - 4. Relocation Based on Relocation Relocation Entries Relocating Symbol Reference

More information

Redirecting functions in shared ELF libraries

Redirecting functions in shared ELF libraries Redirecting functions in shared ELF libraries Written by: Anthony V. Shoumikhin, Developer of Driver Development Team, Apriorit Inc. http://www.apriorit.com TABLE OF CONTENTS 1. THE PROBLEM 2 1.1 WHAT

More information

Link 8.B Dynamic Linking

Link 8.B Dynamic Linking Link 8.B Dynamic Linking Young W. Lim 2019-01-11 Fri Young W. Lim Link 8.B Dynamic Linking 2019-01-11 Fri 1 / 80 Outline 1 Based on 2 background readelf background PIC background 3 example codes 4 examining

More information

Link 4. Relocation. Young W. Lim Thr. Young W. Lim Link 4. Relocation Thr 1 / 48

Link 4. Relocation. Young W. Lim Thr. Young W. Lim Link 4. Relocation Thr 1 / 48 Link 4. Relocation Young W. Lim 2017-09-28 Thr Young W. Lim Link 4. Relocation 2017-09-28 Thr 1 / 48 Outline 1 Linking - 4. Relocation Based on Relocation Relocation Entries Relocation Algorithm Reloation

More information

Binghamton University. CS-220 Spring Loading Code. Computer Systems Chapter 7.5, 7.8, 7.9

Binghamton University. CS-220 Spring Loading Code. Computer Systems Chapter 7.5, 7.8, 7.9 Loading Code Computer Systems Chapter 7.5, 7.8, 7.9 gcc g o ttt ttt.c ttt.c ttt gcc gcc g o ttt ttt.c ttt.c gcc ttt Pre-Processor Linker Compiler Assembler ttt.s ttt.o What is in a binary executable file?

More information

Operating Systems CMPSC 473. Process Management January 29, Lecture 4 Instructor: Trent Jaeger

Operating Systems CMPSC 473. Process Management January 29, Lecture 4 Instructor: Trent Jaeger Operating Systems CMPSC 473 Process Management January 29, 2008 - Lecture 4 Instructor: Trent Jaeger Last class: Operating system structure and basics Today: Process Management Why Processes? We have programs,

More information

Payload Already Inside: Data re-use for ROP Exploits

Payload Already Inside: Data re-use for ROP Exploits Payload Already Inside: Data re-use for ROP Exploits Long Le longld at vnsecurity.net Thanh Nguyen rd at vnsecurity.net 1 HITB2010KUL DEEPSEC Agenda Introduction Recap on stack overflow & mitigations Multistage

More information

Stack frame unwinding on ARM

Stack frame unwinding on ARM Stack frame unwinding on ARM Ken Werner LDS, Budapest 2011 http:/www.linaro.org why? Who needs to unwind the stack? C++ exceptions GDB anyone who wants to display the call chain Unwinding in General How

More information

Today s Big Adventure

Today s Big Adventure Today s Big Adventure f.c gcc f.s as f.o c.c gcc c.s as c.o ld a.out How to name and refer to things that don t exist yet How to merge separate name spaces into a cohesive whole More information: - How

More information

CS 33. Linkers. CS33 Intro to Computer Systems XXV 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

CS 33. Linkers. CS33 Intro to Computer Systems XXV 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. CS 33 Linkers CS33 Intro to Computer Systems XXV 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. gcc Steps 1) Compile to start here, supply.c file to stop here: gcc -S (produces.s file) if not

More information

Midterm results Mean: 43, median: 40

Midterm results Mean: 43, median: 40 Midterm results 30 25 20 15 10 5 0 0 9 10 19 20 29 30 39 40 49 50 59 60 69 70 79 80 89 90 99 100 Mean: 43, median: 40 1 / 45 Midterm results 100% 80% 60% 40% 20% 0% 0 20 40 60 80 100 Systems students should

More information

x86 assembly CS449 Spring 2016

x86 assembly CS449 Spring 2016 x86 assembly CS449 Spring 2016 CISC vs. RISC CISC [Complex instruction set Computing] - larger, more feature-rich instruction set (more operations, addressing modes, etc.). slower clock speeds. fewer general

More information

Draft. Chapter 1 Program Structure. 1.1 Introduction. 1.2 The 0s and the 1s. 1.3 Bits and Bytes. 1.4 Representation of Numbers in Memory

Draft. Chapter 1 Program Structure. 1.1 Introduction. 1.2 The 0s and the 1s. 1.3 Bits and Bytes. 1.4 Representation of Numbers in Memory Chapter 1 Program Structure In the beginning there were 0s and 1s. GRR 1.1 Introduction In this chapter we will talk about memory: bits, bytes and how data is represented in the computer. We will also

More information

- Instructions: Specify operations to perform - Variables: Operands that can change over time - Constants: Operands that never change

- Instructions: Specify operations to perform - Variables: Operands that can change over time - Constants: Operands that never change Today s Big Adventure How is a program executed? fc gcc fs as fo On Unix systems, read by loader compile time run time cc gcc cs as co ld aout ld loader cache How to name and refer to things that don t

More information

Linking: from the object file to the executable An overview of static and dynamic linking

Linking: from the object file to the executable An overview of static and dynamic linking Linking: from the object file to the executable An overview of static and dynamic linking Alessandro Di Federico Politecnico di Milano April 11, 2018 Index ELF format overview Static linking Dynamic linking

More information

Dynamic libraries explained

Dynamic libraries explained Dynamic libraries explained as seen by a low-level programmer I.Zhirkov 2017 1 Exemplary environment Intel 64 aka AMD64 aka x86_64. GNU/Linux Object file format: ELF files. Languages: C, Assembly (NASM)

More information

ELF (1A) Young Won Lim 3/24/16

ELF (1A) Young Won Lim 3/24/16 ELF (1A) Copyright (c) 21-216 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

CSE2421 Systems1 Introduction to Low-Level Programming and Computer Organization

CSE2421 Systems1 Introduction to Low-Level Programming and Computer Organization Spring 2013 CSE2421 Systems1 Introduction to Low-Level Programming and Computer Organization Kitty Reeves TWRF 8:00-8:55am 1 Compiler Drivers = GCC When you invoke GCC, it normally does preprocessing,

More information

Programming Linux Anti-Reversing Techniques

Programming Linux Anti-Reversing Techniques Programming Linux Anti-Reversing Techniques Jacob Baines This book is for sale at http://leanpub.com/anti-reverse-engineering-linux This version was published on 2016-12-20 This is a Leanpub book. Leanpub

More information

Machine Language, Assemblers and Linkers"

Machine Language, Assemblers and Linkers Machine Language, Assemblers and Linkers 1 Goals for this Lecture Help you to learn about: IA-32 machine language The assembly and linking processes 2 1 Why Learn Machine Language Last stop on the language

More information

CPEG421/621 Tutorial

CPEG421/621 Tutorial CPEG421/621 Tutorial Compiler data representation system call interface calling convention Assembler object file format object code model Linker program initialization exception handling relocation model

More information

Link 2. Object Files

Link 2. Object Files Link 2. Object Files Young W. Lim 2017-09-23 Sat Young W. Lim Link 2. Object Files 2017-09-23 Sat 1 / 40 Outline 1 Linking - 2. Object Files Based on Oject Files ELF Sections Example Program Source Codes

More information

Link 2. Object Files

Link 2. Object Files Link 2. Object Files Young W. Lim 2017-09-20 Wed Young W. Lim Link 2. Object Files 2017-09-20 Wed 1 / 33 Outline 1 Linking - 2. Object Files Based on Oject Files ELF Sections Example Program Source Codes

More information

EE458 - Embedded Systems Lecture 4 Embedded Devel.

EE458 - Embedded Systems Lecture 4 Embedded Devel. EE458 - Embedded Lecture 4 Embedded Devel. Outline C File Streams References RTC: Chapter 2 File Streams man pages 1 Cross-platform Development Environment 2 Software available on the host system typically

More information

238P: Operating Systems. Lecture 7: Basic Architecture of a Program. Anton Burtsev January, 2018

238P: Operating Systems. Lecture 7: Basic Architecture of a Program. Anton Burtsev January, 2018 238P: Operating Systems Lecture 7: Basic Architecture of a Program Anton Burtsev January, 2018 What is a program? What parts do we need to run code? Parts needed to run a program Code itself By convention

More information

Binary Analysis and Reverse Engineering

Binary Analysis and Reverse Engineering Pattern Recognition and Applications Lab Binary Analysis and Reverse Engineering Ing. Davide Maiorca, Ph.D. davide.maiorca@diee.unica.it Computer Security A.Y. 2017/2018 Department of Electrical and Electronic

More information

Link 7. Static Linking

Link 7. Static Linking Link 7. Static Linking Young W. Lim 2018-12-21 Fri Young W. Lim Link 7. Static Linking 2018-12-21 Fri 1 / 41 Outline 1 Linking - 7. Static Linking Based on Static Library Examples Linking with Static Libraries

More information

x86 assembly CS449 Fall 2017

x86 assembly CS449 Fall 2017 x86 assembly CS449 Fall 2017 x86 is a CISC CISC (Complex Instruction Set Computer) e.g. x86 Hundreds of (complex) instructions Only a handful of registers RISC (Reduced Instruction Set Computer) e.g. MIPS

More information

Link Edits and Relocatable Code

Link Edits and Relocatable Code Link Edits and Relocatable Code Computer Systems Chapter 7.4-7.7 gcc g o ttt ttt.c ttt.c gcc ttt Pre-Processor Linker Compiler Assembler ttt.s ttt.o gcc g o ttt ttt.c main.c gcc cmd util.c Pre-Processor

More information

System V Application Binary Interface Linux Extensions Version 0.1

System V Application Binary Interface Linux Extensions Version 0.1 System V Application Binary Interface Linux Extensions Version 0.1 Edited by H.J. Lu 1 November 28, 2018 1 hongjiu.lu@intel.com Contents 1 About this Document 4 1.1 Related Information.........................

More information

Frequently asked software questions for EM 8-bit Microcontrollers CoolRISC core architecture

Frequently asked software questions for EM 8-bit Microcontrollers CoolRISC core architecture EM MICROELECTRONIC - MARIN SA AppNote 60 Title: Product Family: Application Note 60 Frequently asked software questions for EM 8-bit Microcontrollers CoolRISC core architecture Part Number: EM6812, EM9550,

More information

CPE 325: Embedded Systems Laboratory Laboratory #9 Tutorial Software Reverse Engineering

CPE 325: Embedded Systems Laboratory Laboratory #9 Tutorial Software Reverse Engineering CPE 325: Embedded Systems Laboratory Laboratory #9 Tutorial Software Reverse Engineering Aleksandar Milenković Email: milenka@uah.edu Web: http://www.ece.uah.edu/~milenka Objective Introduce tools and

More information

Intro x86 Part 3: Linux Tools & Analysis

Intro x86 Part 3: Linux Tools & Analysis Intro x86 Part 3: Linux Tools & Analysis Xeno Kovah 2009/2010 xkovah at gmail Approved for Public Release: 10-3348. Distribution Unlimited All materials is licensed under a Creative Commons Share Alike

More information

Leviathan Research. Extending the ELF Core Format for Forensics Snapshots. Ryan O Neill Security Consultant. 10 November 2014

Leviathan Research. Extending the ELF Core Format for Forensics Snapshots. Ryan O Neill Security Consultant. 10 November 2014 Leviathan Research Extending the ELF Core Format for Forensics Snapshots Ryan O Neill Security Consultant 10 November 2014 limitless innovation. no compromise 2014 Leviathan Security Group Incorporated.

More information

Systems Programming. Fatih Kesgin &Yusuf Yaslan Istanbul Technical University Computer Engineering Department 18/10/2005

Systems Programming. Fatih Kesgin &Yusuf Yaslan Istanbul Technical University Computer Engineering Department 18/10/2005 Systems Programming Fatih Kesgin &Yusuf Yaslan Istanbul Technical University Computer Engineering Department 18/10/2005 Outline How to assemble and link nasm ld gcc Debugging Using gdb; breakpoints,registers,

More information

U Reverse Engineering

U Reverse Engineering U23 2016 - Reverse Engineering Andy andy@koeln.ccc.de November 15, 2016 Introduction Static program analysis Dynamic program analysis Tools strings objdump IDA Hopper gdb Live Reversing Exercises Section

More information

idkwim in SecurityFirst 0x16 years old Linux system security researcher idkwim.tistory.com idkwim.linknow.

idkwim in SecurityFirst 0x16 years old Linux system security researcher idkwim.tistory.com idkwim.linknow. idkwim@gmail.com idkwim in SecurityFirst 0x16 years old Linux system security researcher idkwim.tistory.com choicy90@nate.com (Nate-On) @idkwim idkwim.linknow.kr Zombie PC?? -> No! Return Oriented Programming

More information

Linking. Explain what ELF format is. Explain what an executable is and how it got that way. With huge thanks to Steve Chong for his notes from CS61.

Linking. Explain what ELF format is. Explain what an executable is and how it got that way. With huge thanks to Steve Chong for his notes from CS61. Linking Topics How do you transform a collection of object files into an executable? How is an executable structured? Why is an executable structured as it is? Learning Objectives: Explain what ELF format

More information

C Compilation Model. Comp-206 : Introduction to Software Systems Lecture 9. Alexandre Denault Computer Science McGill University Fall 2006

C Compilation Model. Comp-206 : Introduction to Software Systems Lecture 9. Alexandre Denault Computer Science McGill University Fall 2006 C Compilation Model Comp-206 : Introduction to Software Systems Lecture 9 Alexandre Denault Computer Science McGill University Fall 2006 Midterm Date: Thursday, October 19th, 2006 Time: from 16h00 to 17h30

More information

Optimizing C For Microcontrollers

Optimizing C For Microcontrollers Optimizing C For Microcontrollers Khem Raj, Comcast Embedded Linux Conference & IOT summit - Portland OR Agenda Introduction Knowing the Tools Data Types and sizes Variable and Function Types Loops Low

More information

ECE 471 Embedded Systems Lecture 4

ECE 471 Embedded Systems Lecture 4 ECE 471 Embedded Systems Lecture 4 Vince Weaver http://www.eece.maine.edu/ vweaver vincent.weaver@maine.edu 12 September 2013 Announcements HW#1 will be posted later today For next class, at least skim

More information

ELF (1A) Young Won Lim 10/22/14

ELF (1A) Young Won Lim 10/22/14 ELF (1A) Copyright (c) 2010-2014 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Building C Programs. Shawn T. Brown Director of Public Health Applications Pittsburgh Supercomputing Center Pittsburgh Supercomputing Center

Building C Programs. Shawn T. Brown Director of Public Health Applications Pittsburgh Supercomputing Center Pittsburgh Supercomputing Center Building C Programs Shawn T. Brown Director of Public Health Applications Pittsburgh Supercomputing Center 2012 Pittsburgh Supercomputing Center Computers do not understand programming languages #include

More information

Computer Systems Organization

Computer Systems Organization Computer Systems Organization 1 Outline 2 A software view User Interface 3 How it works 4 The gcc compilation system 5 The gcc compilation system hello.c (source code) Pre-processor (cpp) hello.i (modified

More information

Buffer Overflow Attack

Buffer Overflow Attack Buffer Overflow Attack What every applicant for the hacker should know about the foundation of buffer overflow attacks By (Dalgona@wowhacker.org) Email: zinwon@gmail.com 2005 9 5 Abstract Buffer overflow.

More information

Fight crime. Unravel incidents... one byte at a time.

Fight crime. Unravel incidents... one byte at a time. Fight crime. Unravel incidents... one byte at a time. Copyright SANS Institute Author Retains Full Rights This paper is from the SANS Computer Forensics and e-discovery site. Reposting is not permited

More information

CS429: Computer Organization and Architecture

CS429: Computer Organization and Architecture CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: January 13, 2017 at 08:55 CS429 Slideset 25: 1 Relocating Symbols

More information

ECE 598 Advanced Operating Systems Lecture 10

ECE 598 Advanced Operating Systems Lecture 10 ECE 598 Advanced Operating Systems Lecture 10 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 22 February 2018 Announcements Homework #5 will be posted 1 Blocking vs Nonblocking

More information

Link 4. Relocation. Young W. Lim Thr. Young W. Lim Link 4. Relocation Thr 1 / 26

Link 4. Relocation. Young W. Lim Thr. Young W. Lim Link 4. Relocation Thr 1 / 26 Link 4. Relocation Young W. Lim 2017-09-14 Thr Young W. Lim Link 4. Relocation 2017-09-14 Thr 1 / 26 Outline 1 Linking - 4. Relocation Based on Relocation Relocation Entries Relocating Symbol Reference

More information

M2 Instruction Set Architecture

M2 Instruction Set Architecture M2 Instruction Set Architecture Module Outline Addressing modes. Instruction classes. MIPS-I ISA. Translating and starting a program. High level languages, Assembly languages and object code. Subroutine

More information

Relocating Symbols and Resolving External References. CS429: Computer Organization and Architecture. m.o Relocation Info

Relocating Symbols and Resolving External References. CS429: Computer Organization and Architecture. m.o Relocation Info Relocating Symbols and Resolving External References CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: January 13,

More information

Midterm. Median: 56, Mean: "midterm.data" using 1:2 1 / 37

Midterm. Median: 56, Mean: midterm.data using 1:2 1 / 37 30 Midterm "midterm.data" using 1:2 25 20 15 10 5 0 0 20 40 60 80 100 Median: 56, Mean: 53.13 1 / 37 Today s Big Adventure f.c gcc f.s as f.o c.c gcc c.s as c.o ld a.out How to name and refer to things

More information

Virtual and Physical Addresses

Virtual and Physical Addresses Virtual Memory 1 Virtual and Physical Addresses Physical addresses are provided directly by the machine. one physical address space per machine the size of a physical address determines the maximum amount

More information

Link 4. Relocation. Young W. Lim Wed. Young W. Lim Link 4. Relocation Wed 1 / 22

Link 4. Relocation. Young W. Lim Wed. Young W. Lim Link 4. Relocation Wed 1 / 22 Link 4. Relocation Young W. Lim 2017-09-13 Wed Young W. Lim Link 4. Relocation 2017-09-13 Wed 1 / 22 Outline 1 Linking - 4. Relocation Based on Relocation Relocation Entries Relocating Symbol Reference

More information

Lecture 2 Assembly Language

Lecture 2 Assembly Language Lecture 2 Assembly Language Computer and Network Security 9th of October 2017 Computer Science and Engineering Department CSE Dep, ACS, UPB Lecture 2, Assembly Language 1/37 Recap: Explorations Tools assembly

More information

Is stack overflow still a problem?

Is stack overflow still a problem? Morris Worm (1998) Code Red (2001) Secure Programming Lecture 4: Memory Corruption II (Stack Overflows) David Aspinall, Informatics @ Edinburgh 31st January 2017 Memory corruption Buffer overflow remains

More information

Lab 10: Introduction to x86 Assembly

Lab 10: Introduction to x86 Assembly CS342 Computer Security Handout # 8 Prof. Lyn Turbak Wednesday, Nov. 07, 2012 Wellesley College Revised Nov. 09, 2012 Lab 10: Introduction to x86 Assembly Revisions: Nov. 9 The sos O3.s file on p. 10 was

More information

Virtual and Physical Addresses

Virtual and Physical Addresses Virtual Memory 1 Virtual and Physical Addresses Physical addresses are provided directly by the machine. one physical address space per machine the size of a physical address determines the maximum amount

More information

How Compiling and Compilers Work

How Compiling and Compilers Work How Compiling and Compilers Work Dr. Axel Kohlmeyer Research Professor, Department of Mathematics Associate Director, Institute for Computational Science Assistant Vice President for High-Performance Computing

More information

100% 80% 60% 40% 20% 1 / 45. f.c gcc f.s as. c.c gcc c.s as c.o

100% 80% 60% 40% 20% 1 / 45. f.c gcc f.s as. c.c gcc c.s as c.o Midterm results Midterm results 30 100% 25 20 15 10 5 80% 60% 40% 20% 0 0 9 10 19 20 29 30 39 40 49 50 59 60 69 70 79 80 89 90 99 100 Mean: 43, median: 40 0% 0 20 40 60 80 100 Systems students should insist

More information

CNIT 127: Exploit Development. Ch 2: Stack Overflows in Linux

CNIT 127: Exploit Development. Ch 2: Stack Overflows in Linux CNIT 127: Exploit Development Ch 2: Stack Overflows in Linux Stack-based Buffer Overflows Most popular and best understood exploitation method Aleph One's "Smashing the Stack for Fun and Profit" (1996)

More information

Outline. Compiling process Linking libraries Common compiling op2ons Automa2ng the process

Outline. Compiling process Linking libraries Common compiling op2ons Automa2ng the process Compiling Programs Outline Compiling process Linking libraries Common compiling op2ons Automa2ng the process Program compilation Programmers usually writes code in high- level programming languages (e.g.

More information

Simple C Program. Assembly Ouput. Using GCC to produce Assembly. Assembly produced by GCC is easy to recognize:

Simple C Program. Assembly Ouput. Using GCC to produce Assembly. Assembly produced by GCC is easy to recognize: Simple C Program Helloworld.c Programming and Debugging Assembly under Linux slides by Alexandre Denault int main(int argc, char *argv[]) { } printf("hello World"); Programming and Debugging Assembly under

More information

Comp 524 Spring 2009 Exercise 1 Solutions Due in class (on paper) at 3:30 PM, January 29, 2009.

Comp 524 Spring 2009 Exercise 1 Solutions Due in class (on paper) at 3:30 PM, January 29, 2009. Comp 524 Spring 2009 Exercise 1 Solutions Due in class (on paper) at 3:30 PM, January 29, 2009. 1. (20 pts) Construct tombstone diagrams to illustrate the use of the tools developed in Programming Assignment

More information

Memory and C/C++ modules

Memory and C/C++ modules Memory and C/C++ modules From Reading #5 and mostly #6 More OOP topics (templates; libraries) as time permits later Program building l Have: source code human readable instructions l Need: machine language

More information

Program Exploitation Intro

Program Exploitation Intro Program Exploitation Intro x86 Assembly 04//2018 Security 1 Univeristà Ca Foscari, Venezia What is Program Exploitation "Making a program do something unexpected and not planned" The right bugs can be

More information

LC-3 Assembly Language

LC-3 Assembly Language Chapter 7 LC-3 Assembly Language CS Reality You ve got to know assembly Chances are, you ll never write program in assembly Compilers are much better & more patient than you are Understanding assembly

More information

Command Line Interface / Application Programming Interface (cliapi) Kevin Sheldrake rtfc.org.uk

Command Line Interface / Application Programming Interface (cliapi) Kevin Sheldrake rtfc.org.uk Command Line Interface / Application Programming Interface (cliapi) Kevin Sheldrake rtfc.org.uk WTF? cliapi is a tool that runs individual functions in an executable or library on linux. Sometimes a function

More information

Reducing Memory Usage at Shard Library Use on Embedded Devices

Reducing Memory Usage at Shard Library Use on Embedded Devices Reducing Memory Usage at Shard Library Use on Embedded Devices 2007.02.22 Tetsuji Yamamoto, Matsushita Electric Industrial Co., Ltd. Masashige Mizuyama, Panasonic Mobile Communications Co., Ltd. [translated

More information

CS 550 Operating Systems Spring Process I

CS 550 Operating Systems Spring Process I CS 550 Operating Systems Spring 2018 Process I 1 Process Informal definition: A process is a program in execution. Process is not the same as a program. Program is a passive entity stored in the disk Process

More information

Topics. CS429: Computer Organization and Architecture. File Inclusion. A Simple C Program. Intro to C

Topics. CS429: Computer Organization and Architecture. File Inclusion. A Simple C Program. Intro to C Topics CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: June 7, 2018 at 08:22 Simple C programs: basic structure,

More information

High Performance Computing Lecture 1. Matthew Jacob Indian Institute of Science

High Performance Computing Lecture 1. Matthew Jacob Indian Institute of Science High Performance Computing Lecture 1 Matthew Jacob Indian Institute of Science Agenda 1. Program execution: Compilation, Object files, Function call and return, Address space, Data & its representation

More information

Introduction Presentation A

Introduction Presentation A CSE 2421/5042: Systems I Low-Level Programming and Computer Organization Introduction Presentation A Read carefully: Bryant Chapter 1 Study: Reek Chapter 2 Skim: Reek Chapter 1 08/22/2018 Gojko Babić Some

More information

Generating Programs and Linking. Professor Rick Han Department of Computer Science University of Colorado at Boulder

Generating Programs and Linking. Professor Rick Han Department of Computer Science University of Colorado at Boulder Generating Programs and Linking Professor Rick Han Department of Computer Science University of Colorado at Boulder CSCI 3753 Announcements Moodle - posted last Thursday s lecture Programming shell assignment

More information

Changelog. Brief Assembly Refresher. a logistics note. last time

Changelog. Brief Assembly Refresher. a logistics note. last time Changelog Brief Assembly Refresher Changes made in this version not seen in first lecture: 23 Jan 2018: if-to-assembly if (...) goto needed b < 42 23 Jan 2018: caller/callee-saved: correct comment about

More information

Executables and Linking. CS449 Spring 2016

Executables and Linking. CS449 Spring 2016 Executables and Linking CS449 Spring 2016 Remember External Linkage Scope? #include int global = 0; void foo(); int main() { foo(); printf( global=%d\n, global); return 0; } extern int

More information

Linkers and Loaders. CS 167 VI 1 Copyright 2008 Thomas W. Doeppner. All rights reserved.

Linkers and Loaders. CS 167 VI 1 Copyright 2008 Thomas W. Doeppner. All rights reserved. Linkers and Loaders CS 167 VI 1 Copyright 2008 Thomas W. Doeppner. All rights reserved. Does Location Matter? int main(int argc, char *[ ]) { return(argc); } main: pushl %ebp ; push frame pointer movl

More information

CS165 Computer Security. Understanding low-level program execution Oct 1 st, 2015

CS165 Computer Security. Understanding low-level program execution Oct 1 st, 2015 CS165 Computer Security Understanding low-level program execution Oct 1 st, 2015 A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns

More information

Brief Assembly Refresher

Brief Assembly Refresher Brief Assembly Refresher 1 Changelog 1 Changes made in this version not seen in first lecture: 23 Jan 2018: if-to-assembly if (...) goto needed b < 42 23 Jan 2018: caller/callee-saved: correct comment

More information

LINKING. Jo, Heeseung

LINKING. Jo, Heeseung LINKING Jo, Heeseung PROGRAM TRANSLATION (1) A simplistic program translation scheme m.c ASCII source file Translator p Binary executable object file (memory image on disk) Problems: - Efficiency: small

More information

Reminder: compiling & linking

Reminder: compiling & linking Reminder: compiling & linking source file 1 object file 1 source file 2 compilation object file 2 library object file 1 linking (relocation + linking) load file source file N object file N library object

More information

Assembly Language Programming Debugging programs

Assembly Language Programming Debugging programs Assembly Language Programming Debugging programs November 18, 2017 Debugging programs During the development and investigation of behavior of system programs various tools are used. Some utilities are

More information

ECE 498 Linux Assembly Language Lecture 1

ECE 498 Linux Assembly Language Lecture 1 ECE 498 Linux Assembly Language Lecture 1 Vince Weaver http://www.eece.maine.edu/ vweaver vincent.weaver@maine.edu 13 November 2012 Assembly Language: What s it good for? Understanding at a low-level what

More information

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08 CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 21: Generating Pentium Code 10 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Simple Code Generation Three-address code makes it

More information

238P: Operating Systems. Lecture 4: Linking and Loading (Basic architecture of a program) Anton Burtsev October, 2018

238P: Operating Systems. Lecture 4: Linking and Loading (Basic architecture of a program) Anton Burtsev October, 2018 238P: Operating Systems Lecture 4: Linking and Loading (Basic architecture of a program) Anton Burtsev October, 2018 What is a program? What parts do we need to run code? Parts needed to run a program

More information

143A: Principles of Operating Systems. Lecture 4: Linking and Loading (Basic architecture of a program) Anton Burtsev October, 2018

143A: Principles of Operating Systems. Lecture 4: Linking and Loading (Basic architecture of a program) Anton Burtsev October, 2018 143A: Principles of Operating Systems Lecture 4: Linking and Loading (Basic architecture of a program) Anton Burtsev October, 2018 What is a program? What parts do we need to run code? Parts needed to

More information

CSCI 334: Principles of Programming Languages. Computer Architecture (a really really fast introduction) Lecture 11: Control Structures II

CSCI 334: Principles of Programming Languages. Computer Architecture (a really really fast introduction) Lecture 11: Control Structures II 1 byte{ 1 byte{ CSCI 334: Principles of Programming Languages Lecture 11: Control Structures II Computer Architecture (a really really fast introduction) Instructor: Dan Barowy Memory Instructions main

More information

CIT 595 Spring System Software: Programming Tools. Assembly Process Example: First Pass. Assembly Process Example: Second Pass.

CIT 595 Spring System Software: Programming Tools. Assembly Process Example: First Pass. Assembly Process Example: Second Pass. System Software: Programming Tools Programming tools carry out the mechanics of software creation within the confines of the operating system and hardware environment Linkers & Loaders CIT 595 Spring 2010

More information

CSC 2400: Computer Systems. Using the Stack for Function Calls

CSC 2400: Computer Systems. Using the Stack for Function Calls CSC 24: Computer Systems Using the Stack for Function Calls Lecture Goals Challenges of supporting functions! Providing information for the called function Function arguments and local variables! Allowing

More information

CSC 405 Computer Security Reverse Engineering Part 1

CSC 405 Computer Security Reverse Engineering Part 1 CSC 405 Computer Security Reverse Engineering Part 1 Alexandros Kapravelos akaprav@ncsu.edu Introduction Reverse engineering process of analyzing a system understand its structure and functionality used

More information

Overview REWARDS TIE HOWARD Summary CS 6V Data Structure Reverse Engineering. Zhiqiang Lin

Overview REWARDS TIE HOWARD Summary CS 6V Data Structure Reverse Engineering. Zhiqiang Lin CS 6V81-05 Data Structure Reverse Engineering Zhiqiang Lin Department of Computer Science The University of Texas at Dallas September 2 nd, 2011 Outline 1 Overview 2 REWARDS 3 TIE 4 HOWARD 5 Summary Outline

More information

CS 4400 Fall 2018 Midterm Exam 2 Practice (Version 2)

CS 4400 Fall 2018 Midterm Exam 2 Practice (Version 2) CS 4400 Fall 2018 Midterm Exam 2 Practice (Version 2) Name: Instructions You will have eighty minutes to complete the actual open-book, opennote exam. Electronic devices will be allowed only to consult

More information

CS429: Computer Organization and Architecture

CS429: Computer Organization and Architecture CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: September 6, 2017 at 18:02 CS429 Slideset C: 1 Topics Simple C programs:

More information