Please keep Freddie in the recipents since it's possible he haven't subscribed. On 2019-03-07 13:58 +0100, Matthias Pfaller wrote: > On 03/07/2019 01:16 PM, Freddie Chopin wrote: > > No worries, it won't optimize them away, there's also a header where > > these variables are declared with `extern ...` (omitted that in the > > example, as this doesn't change anything) and all of them will be used > > in the project. I'm just concerned about their order. > > Just put them into a structure. If you need to maintain the old names, > you can always use #define. > > struct { > int a; > int b; > int c; > } globals; I think we'll need "extern volatile struct". The access to one volatile struct is kept even with -O3. > #define a global.a > #define b global.b > #define c global.c Anyway, using linker script is the right way to do this and I recommend to do so. -- Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx> School of Aerospace Science and Technology, Xidian University