[coreboot] global variables in romstage

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Sat Aug 14 12:40:59 CEST 2010

On 14.08.2010 12:24, Stefan Reinauer wrote:
>  On 8/14/10 11:50 AM, Carl-Daniel Hailfinger wrote:
>> On 14.08.2010 11:40, Stefan Reinauer wrote:
>>>  On 8/12/10 9:27 PM, Patrick Georgi wrote:
>>>> 1. [...]
>>>> This one looks for the size of .bss and .data (initialized and
>>>> uninitialized globals) and breaks the build if it finds any. It doesn't
>>>> tell, which global variables are involved.
>>>> 2. Add .bss and .data to /DISCARD/.
>>>> [...]
>>> I prefer option one, too, as
>>> - it catches all global variables, not just the used ones. We want to be
>>> sure that no such code sneaks in even if it's not used.
>>> - it provides a clear error message on what is wrong, inszead of the
>>> more cryptic one saying that a variable is defined in a discarded section.
>> Should we move some of the section checking of v3 to v4 as well? I will
>> soon have a bit more free time and plan to get up to speed on coreboot
>> development again.
> util/sectionchecker/sectionchecker ?
> Looks nice. I think this might be a way to go.
> What are the advantages over the two suggestions above?

Quoting from that file:
# This program checks whether a given list of files ($3+) has any writable
# and allocatable non-empty sections. If so, the name of the file, the
name of
# the section and the symbols in that section are printed and an error is
# returned.

Given that the code already exists and worked well back then, it might
be a good starting point.
The sectionchecker is not a ldscript and that might make it more
attractive for some people.



More information about the coreboot mailing list