Patchwork Avoid globals in romstage

login
register
about
Submitter Patrick Georgi
Date 2010-09-25 11:52:07
Message ID <4C9DE267.5090308@georgi-clan.de>
Download mbox | patch
Permalink /patch/1974/
State Accepted
Headers show

Comments

Patrick Georgi - 2010-09-25 11:52:07
Hi,

attached patch makes globals in romstage a build breaking condition,
given that .bss and .data are allocated in ROM areas (ie. non-writable)
this is provides some protection against certain coding errors.


Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Stefan Reinauer - 2010-09-25 14:13:54
On 9/25/10 1:52 PM, Patrick Georgi wrote:
> attached patch makes globals in romstage a build breaking condition,
> given that .bss and .data are allocated in ROM areas (ie. non-writable)
> this is provides some protection against certain coding errors.
>
>
> Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>

> Index: src/arch/i386/init/ldscript_fallback_cbfs.lb
> ===================================================================
> --- src/arch/i386/init/ldscript_fallback_cbfs.lb	(Revision 5839)
> +++ src/arch/i386/init/ldscript_fallback_cbfs.lb	(Arbeitskopie)
> @@ -49,4 +49,5 @@
>  		*(.comment.*)
>  		*(.note.*)
>  	}
> +	_bogus = ASSERT((SIZEOF(.bss) + SIZEOF(.data)) == 0, "Do not use global variables in romstage");
>  }

Patch

Index: src/arch/i386/init/ldscript_fallback_cbfs.lb

===================================================================
--- src/arch/i386/init/ldscript_fallback_cbfs.lb	(Revision 5839)

+++ src/arch/i386/init/ldscript_fallback_cbfs.lb	(Arbeitskopie)

@@ -49,4 +49,5 @@ 

 		*(.comment.*)
 		*(.note.*)
 	}
+	_bogus = ASSERT((SIZEOF(.bss) + SIZEOF(.data)) == 0, "Do not use global variables in romstage");
 }