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: variables order(arrange)


On 04/08/14 07:40, Man Glory wrote:
Is there no easier way? Generally, it is very strange. In most
compilers I used earlier variables placed in memory one after another,
in the order they are declared in the program.  Or you had to use some
flag when compiling application. Applied to these solutions.
As far I understand, in order to place a section in the script I need
to know their names. How to find the names of the sections?
Not really. The compiler and linker are free to rearrange variable locations relative to each other. Depending on two variables to land physically in memory next to each other is, umm, bad practice.

If you absolutely must do that, then the way to go is to get those variables into their own sections then use a linker script to ensure those sections are adjacent.

Alternately, put them in a structure.

jeff



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