[U-Boot] [PATCH 3/3 v2] Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value

Alessandro Rubini rubini-list at gnudd.com
Tue Oct 26 21:54:29 CEST 2010


> +	/* Round up to make sure size gives nice stack alignment */
> +	DEFINE(GENERATED_GBL_DATA_SIZE,
> +		(sizeof(struct global_data)+15) & ~15);
> +

This has already been applied, sooner than usual.  Isn't it cleaner to
force alignment on the structure itself? This way different architectures
may use different values, if the need arises.

This shows it.

    struct a {
        int i;
    } __attribute__((aligned(16)));

    struct b {
        int i;
    };

    int main()
    {
        printf("%i %i\n", sizeof(struct a), sizeof(struct b));
    }

It prints "16 4" as expected.

/alessandro


More information about the U-Boot mailing list