diff mbox

[U-Boot] Use sizeof(gd_t), not sizeof(struct global_data)

Message ID 1294069652-9114-1-git-send-email-loic.minier@linaro.org
State Changes Requested
Headers show

Commit Message

Loïc Minier Jan. 3, 2011, 3:47 p.m. UTC
The eNET (x86) build fails with "invalid application of 'sizeof' to
incomplete type 'struct global_data'" because x86 doesn't define
struct global_data.  Change sizeof(struct global_data) to sizeof(gd_t)
which is always available.

Cc: Graeme Russ <graeme.russ@gmail.com>
Signed-off-by: Loïc Minier <loic.minier@linaro.org>
---
 lib/asm-offsets.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Mike Frysinger Jan. 3, 2011, 4:35 p.m. UTC | #1
On Mon, Jan 3, 2011 at 10:47 AM, Loïc Minier wrote:
> The eNET (x86) build fails with "invalid application of 'sizeof' to
> incomplete type 'struct global_data'" because x86 doesn't define
> struct global_data.  Change sizeof(struct global_data) to sizeof(gd_t)
> which is always available.

why not change x86's global_data.h to define the struct ?  all other
arches define 'struct global_data'.
-mike
Loïc Minier Jan. 3, 2011, 5 p.m. UTC | #2
On Mon, Jan 03, 2011, Mike Frysinger wrote:
> why not change x86's global_data.h to define the struct ?  all other
> arches define 'struct global_data'.

 We could implement both fixes; there are two reasons I preferred
 sending this fix instead of the one you mention:
 * gd_t is used across the tree, while struct global_data is only used
   in arch/*/include/asm/global_data.h headers
 * the global_data.h header suggested that sizeof(gd_t) was an
   acceptable construct in a comment:
   GENERATED_GBL_DATA_SIZE > sizeof(gd_t)

 I'll send an additional patch to also add struct global_data to
 arch/i386/include/asm/global_data.h.
diff mbox

Patch

diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index 2209561..6a4084e 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -23,7 +23,7 @@  int main(void)
 {
 	/* Round up to make sure size gives nice stack alignment */
 	DEFINE(GENERATED_GBL_DATA_SIZE,
-		(sizeof(struct global_data)+15) & ~15);
+		(sizeof(gd_t)+15) & ~15);
 
 	return 0;
 }