Home » Development and Build » Development, Debugging and Performance Tools » GDB » Meaning of “CONTENTS, ALLOC, LOAD, READONLY, CODE” in ELF sections

Meaning of “CONTENTS, ALLOC, LOAD, READONLY, CODE” in ELF sections

Once we disassembled the ELF to check the sections using “objdump” command, we can see the lines as “CONTENTS, ALLOC, LOAD, READONLY, CODE” along with sections.

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  1 .text         000031b8  00008018  00008018  00008018  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  8 .data         00000844  0001b308  0001b308  0000b308  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  9 .bss          0000007c  0001bb4c  0001bb4c  0000bb4c  2**2
                  ALLOC

In this post, we describe the meaning of each of this. You can also check “How to check sections and its memory map of Binary / ELF using GDB ?” for getting sections details if you are actively debugging using GDB.

The meaning of each of this is as below,

  • ALLOC – Section will have space allocated in the process when loaded. Set for all sections except those containing debug information.
  • LOAD – Section will be loaded from the file into the child process memory. Set for pre-initialized code and data, clear for .bss sections.
  • RELOC – Section needs to be relocated before loading.
  • READONLY – Section cannot be modified by the child process.
  • CODE – Section contains executable code only.
  • DATA – Section contains data only (no executable code).
  • ROM – Section will reside in ROM.
  • CONSTRUCTOR – Section contains data for constructor/destructor lists.
  • HAS_CONTENTS – Section is not empty.
  • NEVER_LOAD – An instruction to the linker to not output the section.
  • COFF_SHARED_LIBRARY – A notification to the linker that the section contains COFF shared library information.
  • IS_COMMON – Section contains common symbols.

Reference : https://sourceware.org/gdb/onlinedocs/gdb/Files.html


Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment