public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jose.marchesi at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/25521] change semantics of const volatile variables
Date: Sun, 10 Jul 2022 20:06:34 +0000	[thread overview]
Message-ID: <bug-25521-4-9YjUiNmVS5@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-25521-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25521

Jose E. Marchesi <jose.marchesi at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jose.marchesi at oracle dot com

--- Comment #6 from Jose E. Marchesi <jose.marchesi at oracle dot com> ---
So I am being bitten by this in the BPF backend [1].

Long story short: LLVM places initialized `volatile const' variables in
.rodata, whereas GCC puts them in .data.

The kernel's libbpf scans the objects and generates a "skeleton" header that,
among other things, reflects the sections in the compiled BPF object.  This
divergence in behavior between LLVM and GCC makes the skeleton to define
different data structures, i.e. obj->rodata->foo vs. obj->data->foo.  See [1]
for details.

I don't actually understand Gabriel's comment, "If it may be modified by
hardware or other external means, it can't go into .rodata section.".  Why not?
 The permissions of the .rodata section eventually determines the permissions
used to map the corresponding pages in the particular process running the
program, but I don't see how can prevent the same physical memory to be updated
by hardware, or even other processes mapping the same physical page using write
perms.

Or what am I missing?  Can we change the behavior of GCC to put such variables
in .rodata?

[1]
https://lore.kernel.org/bpf/87fsj8vjcy.fsf@oracle.com/T/#me726127e166f97fd50f09b647a604f176f809c63

  parent reply	other threads:[~2022-07-10 20:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-25521-4@http.gcc.gnu.org/bugzilla/>
2011-12-22  1:16 ` pinskia at gcc dot gnu.org
2011-12-22  1:18 ` pinskia at gcc dot gnu.org
2022-07-10 20:06 ` jose.marchesi at oracle dot com [this message]
2022-07-10 20:19 ` jose.marchesi at oracle dot com
2022-07-11  1:53 ` jose.marchesi at oracle dot com
2022-08-03 18:21 ` jose.marchesi at oracle dot com
2022-09-29 11:14 ` cvs-commit at gcc dot gnu.org
2005-12-21 18:57 [Bug middle-end/25521] New: " drepper at redhat dot com
2005-12-21 19:17 ` [Bug middle-end/25521] " gdr at integrable-solutions dot net
2005-12-21 19:38 ` drepper at redhat dot com
2005-12-21 19:54 ` gdr at integrable-solutions dot net

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=bug-25521-4-9YjUiNmVS5@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).