C.3 In Linux World

The Linux operating system usually uses GNU binary utilities like GNU C compiler gcc, linking loader ld, library archiver ar, etc. The linker-loader is quite sophisticated and has many options to control its actions.

Each process is allocated upto 4 GB of virtual memory address space, out of which the highest 1 GB address space, where the kernel routines execute on behalf of the user process, is invisible to the users program. This part of the address space is common between all the processes. The following are the general properties of Linux environment:

  • loader does not necessarily load full content to physical memory, but allocates virtual memory pages;
  • uses ELF (Extensible Loader Format);
  • kernel virtual memory is invisible to user-mode code;
  • stack at top of user-mode virtual memory, grows down;
  • program text is kept in write-protected regions;
  • run-time memory (heap) grows upwards.

See Fig. C.8.

 

Memory layout for ELF

 

Fig. C.8 Memory layout for ELF

C.3.1 ld – GNU Linking Loader

The linking loader used in Linux is ld. The executable file format used is ELF. Several programs which help in program development are as follows:

nm – List symbols from object files.

ar – Create, modify and extract from archives.

readelf – Displays information about ELF files.

ldd – Display shared library dependencies.

objdump – Display information from object files.

ranlib – Generate and insert an index in an archive file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.137.38