Re: gcc sections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2021-09-20 at 09:50 +0000, Giacomo Dal Sasso wrote:
> Hi,
> 
> I'm compiling some bare metal code for a risc-v core using gcc.
> I see before the linking stage the object file generated contains .sbss
> and .srodata sections.
> I expected .bss and .rodata sections.
> Where I can find documentation of these sections and in general about
> sections generated by gcc before the linking stage ?

> I mean, linker script maps input sections in output sections but who are
> and what data contains input section gcc provide to the linker ? (.data
> .bss .rodata .text).
> I know what those sections contain but I'm looking for official
> documentation.

Some architectures (for e.g. MIPS, RISC-V, and IA64) have a special
register called "global pointer" (GP).  The content of .sbss, .sdata,
and .srodata will be put into the data area available by GP-relative
addressing, so it's possible to use less instructions to load the data
in those sections.

For MIPS and IA64, the rationale of .sbss is documented in their ELF
psABI.  But the RISC-V psABI doesn't mention .sbss at all. I think it's
problematic but I don't use RISC-V anyway.  Maybe you can raise an issue
in https://github.com/riscv-non-isa/riscv-elf-psabi-doc/ and convince
them to make an explanation.


-- 
Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux