On Thu, 5 Feb 2009 10:58:40 -0200 Alexandre Pereira Nunes <alexandre.nu...@gmail.com> wrote:
> On Wed, Feb 4, 2009 at 11:05 PM, Zoltán Kócsi <zol...@bendor.com.au> > wrote: [cut] > > > > If I compile the above with -O2 or -Os, then if the target is AVR or > > x86_64 then the result is what I expected, func() just loads 3 or > > 12345 then returns and that's all. There is no .rodata generated. > > > > However, compiling for the ARM generates the same function code, > > but it also generates the image of "things" in the .rodata segment. > > Twice. Even when it stores 12345 separatelly. The code never > > actually references any of them and they are not global thus it is > > just wasted memory: > > > > I think it's relevant to ask this: Are you comparing against the same > gcc release on all the three architectures you mention? Almost the same: x86_64: 4.0.2 AVR: 4.0.1 ARM: 4.0.2 So, at least the Intel and the ARM are the same yet the Intel version omits the .rodata, the ARM keeps it. I'll check it with the newer version next week. However, I tend to use the 4.0.x because at least for the ARM it generates smaller code from the same source than the newer versions when optimising with -Os. Zoltan