From: Arnd Bergmann <arnd@arndb•de>
To: benh@kernel•crashing.org
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom•com>,
linuxppc-dev@ozlabs•org, olof@lixom•net
Subject: Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
Date: Tue, 4 Dec 2007 23:05:56 +0100 [thread overview]
Message-ID: <200712042305.56881.arnd@arndb.de> (raw)
In-Reply-To: <1196800273.13230.333.camel@pasglop>
On Tuesday 04 December 2007, Benjamin Herrenschmidt wrote:
> > 2. The call to firmware_has_feature() turns into a compile-time check
> > in
> > many cases, so if the kernel does not contain support for any firmware
> > with the given feature, all the code referenced it can get optimized
> > away by the compiler.
>
> The machine init stuff will soon get rid of whatever test is in it too,
> as soon as I get to do the ELF magic.
Section magic is often painful and causes a number of problems. Moreover, it
won't do the same thing as what the compiler can do. Consider
static int x __attribute__((section("some_platform.data"))) = 1;
static int f(void) __attribute__((section("some_platform.text")));
{
if (firmware_has_feature(FOO))
return x;
return 0;
}
When firmware_has_feature(FOO) statically evaluates to false, f becomes an
empty function and x is left out from the object file.
If you turn it into a platform_is() check and discard all "some_platform"
sections, you need to have both in the vmlinux file and can discard them
at run time, which is something completely different. You can also
discard them in the linker script, but that's a lot more work than having
the compiler do the right thing.
Arnd <><
prev parent reply other threads:[~2007-12-04 22:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-02 6:10 [PATCH v2 1/2] [POWERPC] Add machine initcall macros Grant Likely
2007-12-02 6:10 ` [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code Grant Likely
2007-12-02 6:17 ` Grant Likely
2007-12-02 19:15 ` Olof Johansson
2007-12-04 12:23 ` Geert Uytterhoeven
2007-12-04 13:36 ` Grant Likely
2007-12-04 13:43 ` Geert Uytterhoeven
2007-12-04 20:59 ` Geoff Levand
2007-12-04 14:21 ` Grant Likely
2007-12-04 19:35 ` Arnd Bergmann
2007-12-04 20:31 ` Benjamin Herrenschmidt
2007-12-04 21:52 ` Arnd Bergmann
2007-12-04 22:05 ` Arnd Bergmann [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=200712042305.56881.arnd@arndb.de \
--to=arnd@arndb$(echo .)de \
--cc=Geert.Uytterhoeven@sonycom$(echo .)com \
--cc=benh@kernel$(echo .)crashing.org \
--cc=linuxppc-dev@ozlabs$(echo .)org \
--cc=olof@lixom$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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