* gcc sections
@ 2021-09-20 9:50 Giacomo Dal Sasso
2021-09-20 10:35 ` Xi Ruoyao
0 siblings, 1 reply; 2+ messages in thread
From: Giacomo Dal Sasso @ 2021-09-20 9:50 UTC (permalink / raw)
To: gcc-help
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.
Thanks in advance
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: gcc sections
2021-09-20 9:50 gcc sections Giacomo Dal Sasso
@ 2021-09-20 10:35 ` Xi Ruoyao
0 siblings, 0 replies; 2+ messages in thread
From: Xi Ruoyao @ 2021-09-20 10:35 UTC (permalink / raw)
To: Giacomo Dal Sasso, gcc-help
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@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-20 10:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 9:50 gcc sections Giacomo Dal Sasso
2021-09-20 10:35 ` Xi Ruoyao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).