www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/12/15/09:24:44

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 <rh00 AT controls DOT eurotherm DOT co DOT uk>
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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019