1/22
Flashcards based on lecture notes covering the compilation process, object files, linking (static and dynamic), and loaders.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the role of the preprocessor in creating an executable file?
Handles macros, #include directives, and #xxxx statements, outputting 'pure' C code.
What is the role of the compiler in creating an executable file?
Transforms C code into assembly code, which is human-readable and dependent on the machine architecture.
What is the role of the assembler in creating an executable file?
Creates machine code and stores it in an object file.
What is the role of the linker in creating an executable file?
Combines several object files together to create an executable.
Name the main formats of object files.
ELF (Executable and Linking Format), COFF (Common Object-File Format), and Mach-O.
What are the key sections within an object file?
Machine code ('text' section), global constant data ('data' section), uninitialized data space ('bss'), symbol tables, and relocation information.
What is the purpose of the symbol table in the context of object files?
To store the location of functions, facilitating linking with other object files.
What information does relocation information contain?
Information on what to modify during the linking process; helps resolve addresses in separate parts of a program.
What does the 'nm' command do when examining object files?
It is used to examine the symbols within an object file.
What is the role of the linker (ld) on Linux systems?
To perform the linking of object files and libraries.
What do relocation records do?
Help the linker to fill in all addresses by referencing each other's code and/or data.
What are the two ways libraries can be used in a system?
Statically linked (archives) and dynamically linked (shared objects).
What are the advantages of static linking?
Knowing which library version is used at compile time and ensuring all necessary components are present when copying programs.
What is a disadvantage of static linking?
Programs take more disk space and memory space.
What are the advantages of dynamic linking?
Smaller file sizes, libraries can be upgraded without re-assembling the program, and libraries can be shared in memory.
What is a disadvantage of dynamic linking?
Libraries may change, and the impact on the program is not always clear.
What command is used to find out the shared objects libraries that a program is dynamically linked to?
The 'ldd' (list dynamic dependencies) command.
Why is it important to separate the compiler from the linker?
Program elements can be compiled independently, and changes only require recompilation of the corresponding object, which is important for larger projects.
What is the role of the loader?
To load a process from a file (e.g., ELF format in Linux) into main memory and perform process setup.
What is the purpose of dynamic address translation?
To translate virtual addresses to physical addresses.
What does the statement '#include \"MicroBit.h\"' do in CODAL?
Prompts the preprocessor to include MicroBit.h found in the codal-microbit-v2 library.
Is static or dynamic linking supported for MICROBIT.hex?
Only static linking is supported.
Why does the micro:bit not require a loader to run?
Because it does not use an operating system for handling multiple processes and mapping virtual addresses to physical addresses; it runs one process loaded onto a specific memory area.