Object-File Sections - 2021.2 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
UG1400
ft:locale
English (United States)
Release Date
2021-12-15
Version
2021.2 English

An executable file is created by concatenating input sections from the object files (.o files) being linked together. The compiler, by default, creates code across standard and well-defined sections. Each section is named based on its associated meaning and purpose. The various standard sections of the object file are displayed in the following table.

In addition to these sections, you can also create your own custom sections and assign them to memories of your choice.

Table 1. Sectional Layout of an Object or Executable File
Section Description
.text Text section
.rodata Read only data section
.sdata2 Small read only data section
.sbss2 Small read only uninitialized data section
.data Read/write data section
.sdata Small read/write data section
.sbss Small uninitialized data section
.bss Uninitialized data section
.heap Program heap memory section
.stack Program stack memory section

The reserved sections that you would not typically modify include: .init, .fini, .ctors, .dtors, .got, .got2, and .eh_frame.

.text
This section of the object file contains executable program instructions. This section has the x (executable), r (read-only) and i (initialized) flags. This means that this section can be assigned to an initialized read-only memory (ROM) that is addressable from the processor instruction bus.
.rodata
This section contains read-only data. This section has the r (read-only) and the i (initialized) flags. Like the .text section, this section can also be assigned to an initialized, read-only memory that is addressable from the processor data bus.
.sdata2
This section is similar to the .rodata section. It contains small read-only data of size less than 8 bytes. All data in this section is accessed with reference to the read-only small data anchor. This ensures that all the contents of this section are accessed using a single instruction. You can change the size of the data going into this section with the -G option to the compiler. This section has the r (read-only) and the i (initialized) flags.
.data
This section contains read-write data and has the w (read-write) and the i (initialized) flags. It must be mapped to initialized random access memory (RAM). It cannot be mapped to a ROM.
.sdata
This section contains small read-write data of a size less than 8 bytes. You can change the size of the data going into this section with the -G option. All data in this section is accessed with reference to the read-write small data anchor. This ensures that all contents of the section can be accessed using a single instruction. This section has the w (read-write) and the i (initialized) flags and must be mapped to initialized RAM.
.sbss2
This section contains small, read-only uninitialized data of a size less than 8 bytes. You can change the size of the data going into this section with the -G option. This section has the r (read) flag and can be mapped to ROM.
.sbss
This section contains small uninitialized data of a size less than 8 bytes. You can change the size of the data going into this section with the -G option. This section has the w (read-write) flag and must be mapped to RAM.
.bss
This section contains uninitialized data. This section has the w (read-write) flag and must be mapped to RAM.
.heap
This section contains uninitialized data that is used as the global program heap. Dynamic memory allocation routines allocate memory from this section. This section must be mapped to RAM.
.stack
This section contains uninitialized data that is used as the program stack. This section must be mapped to RAM. This section is typically laid out right after the .heap section. In some versions of the linker, the .stack and .heap sections might appear merged together into a section named .bss_stack.
.init
This section contains language initialization code and has the same flags as .text. It must be mapped to initialized ROM.
.fini
This section contains language cleanup code and has the same flags as .text. It must be mapped to initialized ROM.
.ctors
This section contains a list of functions that must be invoked at program startup and the same flags as .data and must be mapped to initialized RAM.
.dtors
This section contains a list of functions that must be invoked at program end, the same flags as .data, and it must be mapped to initialized RAM.
.got2/.got
This section contains pointers to program data, the same flags as .data, and it must be mapped to initialized RAM.
.eh_frame
This section contains frame unwind information for exception handling. It contains the same flags as .rodata, and can be mapped to initialized ROM.
.tbss
This section holds uninitialized thread-local data that contribute to the program memory image. This section has the same flags as .bss, and it must be mapped to RAM.
.tdata
This section holds initialized thread-local data that contribute to the program memory image. This section must be mapped to initialized RAM.
.gcc_except_table
This section holds language specific data. This section must be mapped to initialized RAM.
.jcr
This section contains information necessary for registering compiled Java classes. The contents are compiler-specific and used by compiler initialization functions. This section must be mapped to initialized RAM.
.fixup
This section contains information necessary for doing fixup, such as the fixup page table and the fixup record table. This section must be mapped to initialized RAM.