WinAVR virtual functions warning

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I'm writing some C++ code just to simulate the COF with AVRStudio and see if the virtual tables, etc are working good. It seems to be Ok in the simulations. The problem is that I'm getting the following two warnings with the WinAVR:

"main_.cc:50: warning: alignment of 'T0::_ZTV2T0' is greater than maximum object file alignment. Using 1"
"main_.cc:86: warning: alignment of 'T1::_ZTV2T1' is greater than maximum object file alignment. Using 1"

I'm attaching the entire program (a single file). It does not do anyhing usefull, it's just to test the C++ compiler. The command line I'm using is:

"avr-gcc.exe -gstabs -Os -mmcu=atmega8 -c -pipe -Wall -Iinc -Wno-non-virtual-dtor -fno-exceptions -std=gnu++98 main_.cc"

Does anybody know if I can create a real program still having this warning or if it's an important one?

Thanks in advance,
Julián

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ignore them.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you Jörg. Could you tell me something about what does these warnings means. I tried to use all the -Wno... I founded about alignment and nothing worked. Do you know if there is a web site, PDF or the like with info about this kind of strange warnings?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> Could you tell me something about what does these warnings means.

I don't know more than you: the text you're reading.

C++ support in AVR-GCC is basically a by-product of GCC supporting C++
on other architectures. The way I read these messages, someone tries
to apply alignment constraints to the virtal method tables (vtables),
which is usually done on larger architectures to improve performance
([machine-]word-aligned memory access is much faster than unaligned
access), or it's even required to be aligned (like on most RISC
machines).

However, as the AVR is an 8-bit machine, it does not offer any
alignment options. (Well, flash ROM is partially organized in 16-bit
words, but that's another matter.) As the object file format
definition reflects this, and only allows for an alignment of 1, the
linker then warns that it cannot abide the requested alignment
constraint.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see, thanks!