This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Variable order and location within the section - optimization level dependent


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


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