CMPSC 311 Test 2 Build Processing Flashcards

(76 cards)

1
Q

semantics, machines

A

Why do we build programs: to turn program —– from human-readable text into something —- understand

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

compilers, interpretors

A

why use language —- instead of ——-? It depends

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

compiling, linking, gcc, Id

A

there are two phases of building a program, — and —–

—– is used to build the program

—- can be used to link the program (or gcc)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

gcc [options]

A

You will run a command to compile: ——————-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

-c

A

—– tells the compiler to just generate object files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

-Wall

A

—- tells the compiler to show all warnings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

-g

A

—– tells the compiler to generate debug information

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

-o

A

— —— write output to a file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

gcc hello.c -c -Wall -g -o hello.c

A

compiling hello.c syntax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

gcc [options]

A

command to link sytnax: ——-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

-l

A

—– link with a library

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

-g

A

tells the compiler to generate debug information

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

-o

A

write output to files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

gcc hello.o goodbye.o -g -lmyexample -o hello

A

linking program syntax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

library

A

A —— is a collection of related code and functions that are linked against a C program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

exports, symbols

A

the library —- ——-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

unresolved symbols

A

Your program object code has ——– ——

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

linker, program

A

the —- pulls chunks of the library. containing those symbols and places them into the ———

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

resolved

A

the program is done linking when all the pieces are —–

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

static

A

It is called —— linking because this is done at link time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

statically linked, archive, linker, code

A

A —– —– library produces object code that is inserted into program at link time.

You are building an —- of the library which the —- uses to search for and transfer —- into your program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

ar rcs lib .a

A

static library syntax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

lib???.a

A

library naming: with very few exceptions all static libraries are named ———

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

name, file

A

You link against the —– of the library, not against the name of the —- in which the library exists

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
R
---- replace existing code with the objects passed
26
C
---- create the library if needed
27
S
----- create an index for relocatable code
28
dynamic library
A ----- ---- is a collection of related code and functions that are ---- at runtime
29
exports, symbols
The library ----- -----
30
unresolved symbols
Your program object code has ----- ------
31
loader
the ---- pulls chunks of the library containing those symbols and places them in the process
32
started, execution
The symbols are resolved when the process is ------ or later during -------
33
any time
it is called dynamic library, because it can be done at ----- -----
34
execution, loadable, launch
a dynamically linked library produces object code that is inserted into program at ------ time. You are building a ---- version of the library which the loader uses to ------ the application
35
gcc -shared -o libmyexample.so a.o b.o c.o d.o
dynamic library syntax
36
position-independent code (PIC)
Important: all object files to be placed in library must have been compiled to ------ ------- ------
37
predefined, memory, jumps, execution
PIC is not dependent on any being located at any ----- location in ------ eg, uses relative -----, so does not matter where it is loaded at ----- time
38
.so
Naming dynamic library with PIC is same as before?? only with ----- extension ???? CHECK SLIDE 11
39
gcc a.c -fpic -c -Wall -g -o a.o
dynamic library PIC syntax
40
preprocessor, compile
The -------- processes input source code files for commands that setup the ------ environment specific to that execution
41
#
The programmer uses ---- directives to indicate what he wants that program to do. Like in ---include. there are more...
42
#include
the ---- directive tells the compiler to include data from some other data file
43
#include "foo.h"
------- ------: this tells the compiler to look in the local (used for application programming)
44
#include
------- ---- : tells the compiler to look at the default directories and any provided by the command line
45
gcc -I, <>
the ------ ---- option: tells the compiler to look in a specific director for include files (that are using the approach) generally speaking, systems programming uses the ---- approach to have better control over what is being included from where
46
#define
the ------- directive allows the user to create a definition symbol that gets search/replaced throughout
47
constant, arrays
The #define is commonly used to define a constant that might be changed in the future eg the size of -----
48
#undef
the ----- directive undoes binding
49
#define
------ can also be used to create simple functions called macros
50
macros, overheads
------ are not called as normal functions, but are replaced during preprocessing thus no function call ------ such as stack operations
51
#if, #ifdef, #ifndef
You can conditionally compile parts of a program, using the -----, -----, and ----- directives
52
make
the --- utility is a utility for binding complex systems/program
53
out of date, dependencies, project files
the make utility: figure out which parts of system are ----- ---- ---- figure out what the ------ are between objects issue command to create the intermediate and final ------ ------
54
make
Note: being a good systems programmer requires mastering the ----- utility
55
Makefile
Each system you want to build has one (or more) files defining how to build, called the ------
56
build, way, relate
a Makefile defines the things to -----, the ---- to build them, and the way they -----
57
Target
Makefile: ---- a thing to build
58
Prerequisites
Makefile: ----- things that the target depends on
59
dependencies
Makefile: ----- between files eg a.o depends on a.c
60
variables
Makefile: ----- dat that defines elements of interest to the build
61
rules
Makefile: ---- are statements of targets, prerequisites and commands
62
rule
Also known as production, a ---- defines how a particular item is built.
63
target: preq1, preq2, preq3.. command1 command2 (NOTE: commands must be tabbed over)
rule syntax
64
target, prereq(1|2|3), commands
rule syntax: - --- is the thing to be built - ---- are things needed to make the target - --- are the UNIX commands to run to make target
65
commands, target, prerequisites
Makefile rules: Key idea: run the ---- to build the ---- when any of the noted ----- are out of date
66
make
To run make, just type ---- at the UNIX prompt.
67
Makefile, targets, dependency graph
running make: | It will open the ---- and build any --- that are out of date. thus it will look at the ------- -----.
68
variables
Makefile ---- allow you to replace some repetitive (and changing text) with others
69
CC=gcc LINK=gcc CFLAGS=-c -Wall -I
some standard Makefile variables include - ----- - ---- - -----
70
special
Make supports a range of ----- variables that are used while evaluating each rule (called built-ins)
71
$@, $^, $
three of the most popular make built-ins - --- is the current rule target - --- is the prerequisite list - --- is the first prerequisite
72
builds
Built-ins are used to make ------ cleaner
73
suffix rule
A ---- ---- defines a default way to generate a target from a type of prerequisites.
74
dependency,
suffix rule: You only need to define the ---- and not the commands for those files.
75
types, productions
Defining suffix rule: Step 1: define the file ----- to be in suffix rules Step 2: define the default -------
76
builds
You will begin to develop a set of patterns for makefiles that you will use repeatedly over time on the different (and increasingly complex) builds. We will explore the use of these over the course of this semester.