Organization: Eurotherm Controls Limited. Address: Faraday Close, Durrington, Worthing, W.Sussex, BN13 3PL, England. Phone: +44 903 268500 Fax: +44 903 265982 From: Richard Hine Date: Thu, 15 Dec 94 10:58:27 GMT To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Ordering of global data I have some C which I am (cross)compiling which generates some global data declarations. The order of this data is important to me and I am having some trouble getting the compiler to leave it in the order in which it is declared. If I have the data declarations in a separate C file and compile them independently, subsequently linking them to the rest of the code then they remain in the order in which they were declared. If I try to compile the entire code in one C file then they are re-ordered into the order in which they are used. I had merged the files in order to improve compilation time and do not wish to modify the C source as it is generated by another tool which is not under my control. Does anyone know how I can persuade gcc to leave the data in the order in which it was declared without splitting up the C or by modifying the source? If not then what changes would you suggest to the C to ensure that the data is kept in order? I am using the following versions - go32 version 1.11.maint4 gcc version 2.5.7 gas version 2.1.1 binutils 2.2 Thanks for your help. p.s. Compiling my entire build in one C file speeded thing up considerably. The build from 12 C files took over 16 minutes but when concatenated into one file it took just 55 seconds.