I'm trying to understand this assembly from a bare-metal project I've cloned from GitHub.
.section .text._start
_start:
// Infinitely wait for events (aka "park the core").
.L_parking_loop:
wfe
b .L_parking_loop
.size _start, . - _start
.type _start, function
.global _start
I'm stuck on the first line. None of the documentation I've found, so far, explains the presence of the _start label at the end of the .section directive. e.g. .section. And most examples I've found just have .section .text. What is the function of the 'extra' ._start?
.text._startis the section name. Often linker scripts will place something like this in a specific place like the beginning of an output section so that this code is output first before anything else. I would check if there is a linker script file with the project. By convention linker scripts usually have an.ldextension (but not required). I would bet you'll find reference to this section in there.KEEP(*(.text._start))in a.textsection. If you want to submit it as an answer, I'll mark it so,.text*) in other cases. For instance, marking the section as 'allocated' and 'read-only' might use the wild card. Others might be.text.irqand.data.mmu, etc. They are 'text' or 'data', but require special positioning. I think purpose is better than.ldas a wart.