Site Tools


ivss-sections

Table of Contents

Sections (ivss)

Sections group emitted bytes under names that the linker can merge and place. Switching sections changes the active output buffer; returning to a section resumes its existing contents:

.section my_data
first:
    .word 11
 
.section my_code
    halt
 
.section my_data
second:
    .word 22

The data section ends with two consecutive words, so second is at offset four. The intervening halt belongs to my_code and does not increase the data section's size.

ivss creates a section when first requested and reuses it on later .section directives. Labels record offsets within the selected section, rather than final runtime addresses. Section switching also does not insert an executable jump: a running processor simply follows its program counter.

The linker can choose explicit placement with an option such as -place=my_code@0x40000000. Choosing a section name alone does not set that address or change the emulator's initial program counter. Keep executable flow and data placement consistent when linking the complete program.

Source: elf.c.

ivss-sections.md · Last modified: by 127.0.0.1