[coreboot] The fallacy of the CONFIG_* plague

Aaron Durbin adurbin at chromium.org
Wed Feb 12 19:53:41 CET 2014


On Wed, Feb 12, 2014 at 12:44 PM, Patrick Georgi <patrick at georgi-clan.de> wrote:
> Am Mittwoch, den 12.02.2014, 12:30 -0600 schrieb mrnuke:
>> Thoughts,
> No.
>
>> comments,
> Really?
>
>> concerns,
> I like solving things at compile time that can be solved at compile time
> (and in fact even earlier, if possible). No need to store "Mister stole
> my lollipop" if the board is guaranteed to ship with one.
>
> A simple solution to your problem would be to store everything as AST in
> object files and letting the linker resolv everything - that would fit
> your "static library" requirement while still having Kconfig options
> work. So it's rather arbitrary. (and the fun thing is, our toolchain is
> even capable of that given the right switches, so it's not purely
> theoretical)
>
> Having a coreboot that determines at runtime again and again and again
> what kind of device it's running on is quite a departure from the design
> so far.
>
> Also, to dissect your example, what's the difference between:
>  void function(bool has_lollipop)
>  {
>         if (has_lollipop)
>                 printk(BIOS_YUMMY, "Sucking on a lollipop\n");
>         else
>                 printk(BIOS_INFO, "Mister stole my lollipop\n");
>  }
>
> and
>
>  void function(bool has_lollipop)
>  {
>         if (CONFIG_EXISTS(CONFIG_HAS_LOLLIPOP))
>                 printk(BIOS_YUMMY, "Sucking on a lollipop\n");
>         else
>                 printk(BIOS_INFO, "Mister stole my lollipop\n");
>  }
>
> from a stilistic point of view? (except for the upper case - which we
> could fix, if we want...)
> It's a huge difference in what ends up in the binary.
>

To add to this. I think archive files as a static target is
oversimplifying things. We have to be very careful about weak
functions and how the linker resolves said functions. Moreover, the
compiler's ability is being underestimated. Unless one is going to go
out of their way to have global variable in another compilation unit
be the value of CONFIG_FOO the compiler will cull all the dead code it
knows it won't hit.

-Aaron



More information about the coreboot mailing list