All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <jbeulich@novell.com>
To: "Sam Ravnborg" <sam@ravnborg.org>
Cc: "Chuck Ebbert" <cebbert@redhat.com>,
	<linux-kernel@vger.kernel.org>,
	"Al Viro" <viro@ZenIV.linux.org.uk>
Subject: Re: section breakage on ppc64 (aka __devinitconst is broken by design)
Date: Fri, 08 Feb 2008 09:17:03 +0000	[thread overview]
Message-ID: <47AC2C1F.76E4.0078.0@novell.com> (raw)
In-Reply-To: <20080208084744.GA27120@uranus.ravnborg.org>

>Al posted the following:
>====================================================================
>; cat >a.c <<'EOF'
>const char foo[] __attribute__ ((__section__(".blah"))) = "";
>const char * const bar __attribute__((__section__(".blah"))) = "";
>EOF
>; gcc -m32 -S a.c
>; gcc -m64 -S a.c
>a.c:2: error: bar causes a section type conflict
>;
>
>That's 4.1.2 on ppc.  What happens is that the second declaration
>wants to make .blah writable.  We actually trigger that in ppc64
>builds on drivers/net/natsemi.c.
>
>Note that on ppc64 without explicit sections you have the second one land in
>.data.rel.ro.local, which is "aw",progbits.
>====================================================================
>
>Se we see that despite being marked as const the the section
>is in one case marked as read-only by gcc and in another case the section
>is marked as rw.

Oh, indeed, this kind of a construct also fails for ia64 on existing gcc-s.

>And this is with the gcc version that is in use today and which
>we must support.
>Thats why I think we have to loose the constification that is going on
>or we should loose the section attribute on the data.

That is very unfortunate, but is then a good reason to fold the
'const' into the __devinitconst definition as I originally suggested (and
perhaps that's the reason why I didn't have problems with my version
of the patch on ia64) - that way, those architectures that can't tolerate
it could have __devinitconst continue to resolve to __devinitdata,
resulting in traditional section allocation, while targets like x86 can still
benefit from the constification.

Apart from that we may want to approach the gcc folks to allow a way
to override this 'optimization for the kernel (or more generally for
statically linked executables).

Jan


      reply	other threads:[~2008-02-08  9:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-03 13:08 section breakage on ppc64 (aka __devinitconst is broken by design) Al Viro
2008-02-03 17:26 ` Sam Ravnborg
2008-02-03 18:02   ` Al Viro
2008-02-03 20:30     ` Sam Ravnborg
2008-02-03 21:02       ` Al Viro
2008-02-04  0:27         ` Olivier Galibert
2008-02-07 18:33 ` Chuck Ebbert
2008-02-07 18:54   ` Sam Ravnborg
2008-02-08  8:14     ` Jan Beulich
2008-02-08  8:47       ` Sam Ravnborg
2008-02-08  9:17         ` Jan Beulich [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=47AC2C1F.76E4.0078.0@novell.com \
    --to=jbeulich@novell.com \
    --cc=cebbert@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.