On 10/4/2010 6:13 PM, Reinhard Meyer wrote: >> > bar: >> > @ Function supports interworking. >> > @ args = 0, pretend = 0, frame = 0 >> > @ frame_needed = 0, uses_anonymous_args = 0 >> > @ link register save eliminated. >> > @ lr needed for prologue >> > mov r2, #5 >> > mov r3, #4096 >> > str r2, [r3, #0] >> > bx lr >> > .size bar, .-bar >> > .ident "GCC: (GNU) 4.2.2" >> > >> > >> > Note that this is with GCC 4.2.2. Even GCC 4.0.0 behaves the same, so >> > this is *not* an issue with very recent tool chains. > OK, for directly adressing elements inside a packed struct; > but the original post said: > > "struct xyz { > int x; > int y; > int z[CONST]; > } __attribute__ ((packed)); > > struct xyz *abc; > u32 * status_reg = (u32 *)&abc->z[0]; > > writel(status, status_reg);" > > So the "status_reg" pointer is in a completely unrelated (to the packed > struct) > "u32 *" and still the access is done like it was packed. If the > compiler silently drags that attribute along into the "u32 *" > THAT is really sick! >
Yes, This is exactly what I wanted to point out. I can see this behavior with gcc-4.5.0 but the same code works well with gcc-4.2.4 Vipin _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot