bug#311: -mcpu and ISO sizes
Seth David Schoen <schoen <at> loyalty.org>
2003-02-02 06:08:27 GMT
We've observed that the build environment and build host have a
substantial effect on the size of the generated ISO image -- producing
variations up to a million bytes! For example, the nightly builds
produced by gar are around 48000000 bytes, where the result of
building on garson in a chroot with exactly the same source tree is
around 49000000 bytes, or around a 2% overall difference.
Nick and I looked at the individual binaries during the meeting today
and discovered that the chroot-built binaries on garson are typically
substantially larger than the equivalent binaries built on the native
environment on gar. (Interestingly, some binaries, such as openssl,
are exactly the same size, down to the byte. Most binaries, though,
appear to differ in size by a few percent.)
One hypothesis about this is that it has to do with the -mcpu flags
which are being passed to the compiler. Some configure scripts or
Makefiles seem to run "arch" and then pass the equivalent of
-mcpu=$(shell arch) to gcc, causing it to generate code which is
optimized for that particular CPU. (As Nick has pointed out, there is
also -march, which generates code which is optimized for that
particular CPU and might be incompatible with other CPUs. -march is
used by at least one upstream packages, and we ought to purge it very
aggressively.)
The net result, in any case, is definitely individual binaries which
are different sizes depending on which machine they were built on.
The -mcpu discrepancy seems to be a plausible source of these
differences. I ran a compile of a randomly chosen small program with
-Os -mcpu=i386 and again with the same source file and -Os -mcpu=i686
and immediately saw a difference of several hundred bytes (about 2% of
(Continue reading)