In the context of a multi-module compilation process for a high-level language…

In the context of a multi-module compilation process for a high-level language like C, where the compiler generates relocatable object files, the linker resolves symbols across modules, and the loader places the executable in memory, assume a two-pass linking strategy with dynamic loading support. Which of the following statements are theoretically correct regarding the interplay between compiler-generated code, linker operations, and loader functionalities?

  1. A.

    The compiler's code generation phase produces absolute addresses for local variables but leaves external references as symbolic in the object file's relocation table, which the linker resolves by updating with actual addresses from the external symbol table during the linking pass, preventing undefined symbol errors at load time.

  2. B.

    During semantic analysis in the compiler, forward references within a single module are resolved using the symbol table, but cross-module extern declarations create stubs in the object file that the loader (not the linker) patches at execution time, which can lead to segmentation faults if mismatched types are not caught earlier.

  3. C.

    If the compiler optimizes for position-independent code (PIC) in object files, the linker can generate a shared object without absolute relocations, and the loader uses base address adjustments at runtime via the global offset table (GOT), ensuring that intra-module jumps remain relative and do not require linker intervention for rebasing.

  4. D.

    In a dynamic linker-loader system (e.g., for shared libraries), the loader defers symbol resolution until runtime, using a procedure linkage table (PLT) populated by the compiler, which allows for lazy binding and reduces initial load time, but may introduce runtime overhead if not all symbols are pre-resolved by a static linker.

Attempted by 1 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…