patch to align gobal vars having packed attribute
Jeffrey A Law
law@cygnus.com
Thu Aug 10 15:46:00 GMT 2000
In message < Pine.SOL.3.91.1000810090616.21816A-100000@emperor.cygnus.com >you
write:
>
>
> Here is the patch which generates .align 0 for elements of a struct
> having packed attribute.
>
> The patch solves the following 'C' code for mips target.
>
> struct {
> char m1;
> short m2 __attribute__ ((packed));
> } x = {1, 2};
>
> int main()
> {
>
> printf("%d\n", x.m2);
>
> return 0;
> }
>
>
> Here is the patch
>
> * c-typeck.c (output_init_element): Add .align 0 to fields of a
> global struct having packed attribute.
c-* really doesn't seem like the place to to be emitting assembler directives
--
varasm.c and final.c are the traditional places to do that.
Is there any way to output the .align 0 in varasm.c when we start emitting
the declaration/definition of the structure?
jeff
More information about the Gcc-patches
mailing list