This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch to align gobal vars having packed attribute


Hi Jeff,


On Thu, 10 Aug 2000, Jeffrey A Law wrote:

> 
>   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?
> 

  The change i have applied to varasm.c only does if struct is a local 
variable. The above change outputs the .align 0 if struct is a global 
variable.

Chandra
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]