This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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

gcc disobeys const qualifier


Hi,
	I am trying to use C++ in an embedded application where RAM is
limited. It is therefore important to me that structs
declared const are placed in the .text section which goes in ROM. I realise
that if a struct has initialisers that are not constant then the compiler
has no choice but to place it in RAM and generate a constructor. However, I
have found a situation where this happens when all the initialisers are
constant expressions. 

It happens if I have a pointer to a class in the struct and the class is
multiply inherited. In this case the pointer may need an offset added to it
to point to the correct base class. If it does then I get the problem, the
pointer is initialised by a constructor. However, provided base class is not
virtual, the offset is a constant, so could be evaluated by the
assembler/linker.

Does anybody know if this problem is easy to fix and if so how to go about
it, or has it already been addressed? I am using
m68k-coff-gcc version 2.95.1

TIA, Chris

Chris Palmer
E-mail : palmerc@intgame.com




------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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