Variable order and location within the section - optimization level dependent
Ian Lance Taylor
iant@google.com
Wed Oct 16 14:30:00 GMT 2013
On Wed, Oct 16, 2013 at 7:06 AM, Janáček Jiří <jiri.janacek@skoda.cz> wrote:
>
> I do know this approach. I have created sections with the appropriate address ranges and located the variables into those sections by the below mentioned attribute.
> If no optimization is turned on, then the order (means also the address offset of the variable) is correct.
> If -O1 is turned on, the variables order within the section is exactly opposite.
> If -O1 is turned on and the flag -fno-toplevel-reorder is turned on as well, then the order is equal to the requested one. But I would like to apply such a behavior (no reorder) just for some variables in some modules. Other modules should be optimized by -O1 level.
> So I am curious which attributes can define this behavior.
Please don't top-post. Thanks.
It sounds like you are saying that you want to have your global
variables appear in a specific order in a specific section.
There is no attribute that will make that happen. Sorry. The obvious
workaround would be to use a struct.
Ian
More information about the Gcc-help
mailing list