public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@mengyan1223.wang>
To: Giacomo Dal Sasso <giacomo@debugsrl.it>,
	"gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Re: gcc sections
Date: Mon, 20 Sep 2021 18:35:46 +0800	[thread overview]
Message-ID: <e65354483ad67d45608961f075ccdb9c0e3e3740.camel@mengyan1223.wang> (raw)
In-Reply-To: <AS8PR10MB46457A6D6BEECAFF564318C1B4A09@AS8PR10MB4645.EURPRD10.PROD.OUTLOOK.COM>

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

      reply	other threads:[~2021-09-20 10:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20  9:50 Giacomo Dal Sasso
2021-09-20 10:35 ` Xi Ruoyao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e65354483ad67d45608961f075ccdb9c0e3e3740.camel@mengyan1223.wang \
    --to=xry111@mengyan1223.wang \
    --cc=gcc-help@gcc.gnu.org \
    --cc=giacomo@debugsrl.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).